]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
netlink: avoid a double skb free in genlmsg_mcast()
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 14 Mar 2018 20:10:23 +0000 (21:10 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Mar 2018 16:34:48 +0000 (12:34 -0400)
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 <ben.hutchings@codethink.co.uk>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c

index 6f02499ef00725abb6d249a61fd005dbdd413ac0..b9ce82c9440f1cde865a456ca926a6f5782c29a7 100644 (file)
@@ -1106,7 +1106,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group,
        if (!err)
                delivered = true;
        else if (err != -ESRCH)
-               goto error;
+               return err;
        return delivered ? 0 : -ESRCH;
  error:
        kfree_skb(skb);