From: Nicolas Dichtel Date: Wed, 14 Mar 2018 20:10:23 +0000 (+0100) Subject: netlink: avoid a double skb free in genlmsg_mcast() X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=commitdiff_plain;h=9ecf90b305220eade0a5634e6e604cf0e4fed796;ds=sidebyside netlink: avoid a double skb free in genlmsg_mcast() commit 02a2385f37a7c6594c9d89b64c4a1451276f08eb upstream. nlmsg_multicast() consumes always the skb, thus the original skb must be freed only when this function is called with a clone. Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in genlmsg_multicast_allns()") Reported-by: Ben Hutchings Signed-off-by: Nicolas Dichtel Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 3b1b2a29e3a3..c41301ab943f 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -942,7 +942,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 pid, unsigned long group, if (!err) delivered = true; else if (err != -ESRCH) - goto error; + return err; return delivered ? 0 : -ESRCH; error: kfree_skb(skb);