summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2022-12-03 17:46:35 +0800
committerPaolo Abeni <pabeni@redhat.com>2022-12-06 12:58:38 +0100
commit743117a997bbd4840e827295c07e59bcd7f7caa3 (patch)
tree767505b5dc9fe0c1c932beb586351ad031079a8e /net/tipc
parent433c07a13f59856e4585e89e86b7d4cc59348fab (diff)
downloadlinux-stable-743117a997bbd4840e827295c07e59bcd7f7caa3.tar.gz
linux-stable-743117a997bbd4840e827295c07e59bcd7f7caa3.tar.bz2
linux-stable-743117a997bbd4840e827295c07e59bcd7f7caa3.zip
tipc: Fix potential OOB in tipc_link_proto_rcv()
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>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/link.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index e260c0d557f5..b3ce24823f50 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2224,7 +2224,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);