Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f950c0ec authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller
Browse files

ipv6: fix return value check in fib6_add()

In case of error, the function fib6_add_1() returns ERR_PTR()
or NULL pointer. The ERR_PTR() case check is missing in fib6_add().

dpatch engine is used to generated this patch.
(https://github.com/weiyj/dpatch

)

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 185d4c8b
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -819,6 +819,10 @@ int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
					offsetof(struct rt6_info, rt6i_src),
					offsetof(struct rt6_info, rt6i_src),
					allow_create, replace_required);
					allow_create, replace_required);


			if (IS_ERR(sn)) {
				err = PTR_ERR(sn);
				sn = NULL;
			}
			if (!sn) {
			if (!sn) {
				/* If it is failed, discard just allocated
				/* If it is failed, discard just allocated
				   root, and then (in st_failure) stale node
				   root, and then (in st_failure) stale node