]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:33:54 +0000 (21:33 -0400)
[ Upstream commit 02a2385f37a7c6594c9d89b64c4a1451276f08eb ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
net/netlink/genetlink.c

index 97c22c8181345023a47ec8422fa527ede8009a7b..1c58b0326c54f509e615b8fe4da3471477326a30 100644 (file)
@@ -1143,7 +1143,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);