Skip to contentSkip to conversation

sctp: Fix smatch error in ASCONF code

PATCH New Neil Horman 1 participant 1 message Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp: Fix smatch error in ASCONF code

Fix up a missed null pointer check in the asconf code. If we don't find a local address, but we pass in an address length of more than 1, we may dereference a NULL laddr pointer. Currently this can't happen, as the only users of the function pass in the value 1 as the addrcnt parameter, but its not a hot path, and it doesn't hurt to check for NULL should that ever be the case

CC Vlad Yasevich <[email protected]>
CC "David S. Miller" <[email protected]>
CC Dan Carpenter <[email protected]>
---
 net/sctp/socket.c | 3 +++
 1 file changed, 3 insertions(+)
net/sctp/socket.c +3 -0
index cedd9bf..75ebde9 100644
@@ -820,6 +820,9 @@ static int sctp_send_asconf_del_ip(struct sock		*sk,
 			goto skip_mkasconf;
 		}
 
+		if (laddr = NULL)
+			return -EINVAL;
+
 		/* We do not need RCU protection throughout this loop
 		 * because this is done under a socket lock from the
 		 * setsockopt call.
Signature · 1 line
1.7.11.7