]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tipc: check skb_linearize() return value in tipc_disc_rcv()
authorYueHaibing <yuehaibing@huawei.com>
Sat, 19 Nov 2022 07:28:32 +0000 (15:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:40:01 +0000 (17:40 +0100)
[ Upstream commit cd0f6421162201e4b22ce757a1966729323185eb ]

If skb_linearize() fails in tipc_disc_rcv(), we need to free the skb instead of
handle it.

Fixes: 25b0b9c4e835 ("tipc: handle collisions of 32-bit node address hash values")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
Link: https://lore.kernel.org/r/20221119072832.7896-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/discover.c

index 2ae268b674650f33957f2baf6ee1ecb4a9c8f8af..2730310249e3cab7a818489b7728ec2ad547fbd9 100644 (file)
@@ -210,7 +210,10 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *skb,
        u32 self;
        int err;
 
-       skb_linearize(skb);
+       if (skb_linearize(skb)) {
+               kfree_skb(skb);
+               return;
+       }
        hdr = buf_msg(skb);
 
        if (caps & TIPC_NODE_ID128)