]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
tipc: Fix potential OOB in tipc_link_proto_rcv()
authorYueHaibing <yuehaibing@huawei.com>
Sat, 3 Dec 2022 09:46:35 +0000 (17:46 +0800)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 14 Dec 2022 13:02:56 +0000 (14:02 +0100)
[ Upstream commit 743117a997bbd4840e827295c07e59bcd7f7caa3 ]

Fix the potential risk of OOB if skb_linearize() fails in
tipc_link_proto_rcv().

Fixes: 5cbb28a4bf65 ("tipc: linearize arriving NAME_DISTR and LINK_PROTO buffers")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20221203094635.29024-1-yuehaibing@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit af4ccae4b704ee333e199ca27542be0ed040b269)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
net/tipc/link.c

index 115a4a7950f5036eb2562bf97ad9b75da471f120..8fdd3b23bd12306db3fa16b9c81ff0bc093b4224 100644 (file)
@@ -2223,7 +2223,9 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
        if (tipc_own_addr(l->net) > msg_prevnode(hdr))
                l->net_plane = msg_net_plane(hdr);
 
-       skb_linearize(skb);
+       if (skb_linearize(skb))
+               goto exit;
+
        hdr = buf_msg(skb);
        data = msg_data(hdr);