]> git.baikalelectronics.ru Git - kernel.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>
Thu, 8 Dec 2022 10:22:58 +0000 (11:22 +0100)
[ Upstream commit e6fddc47d5f54c109e99d6d4a76a9734cd2d34a8 ]

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

Fixes: b8bd0db28fc0 ("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 0006c9f8719980862bb27a55c529229495e975d1..0436c8f2967d45c0cbe36bb2683e2daf3ef78d83 100644 (file)
@@ -208,7 +208,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)