Эх сурвалжийг харах

ipvs: freeing uninitialized pointer on error

If state != IP_VS_STATE_BACKUP then tinfo->buf is uninitialized.  If
kthread_run() fails then it means we free random memory resulting in an
oops.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Dan Carpenter 12 жил өмнө
parent
commit
b425df4cdd

+ 2 - 0
net/netfilter/ipvs/ip_vs_sync.c

@@ -1795,6 +1795,8 @@ int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid)
 					     GFP_KERNEL);
 					     GFP_KERNEL);
 			if (!tinfo->buf)
 			if (!tinfo->buf)
 				goto outtinfo;
 				goto outtinfo;
+		} else {
+			tinfo->buf = NULL;
 		}
 		}
 		tinfo->id = id;
 		tinfo->id = id;