diff options
author | YueHaibing <yuehaibing@huawei.com> | 2022-12-03 17:46:35 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-14 11:28:30 +0100 |
commit | 8abe4a23980700f4a8a28988fd3e07bb461bd483 (patch) | |
tree | 90ef605e5059cbb685c548d3e1ef075b8d381f6f | |
parent | 3a4eddd1cb023a71df4152fcc76092953e6fe95a (diff) | |
download | linux-stable-8abe4a23980700f4a8a28988fd3e07bb461bd483.tar.gz linux-stable-8abe4a23980700f4a8a28988fd3e07bb461bd483.tar.bz2 linux-stable-8abe4a23980700f4a8a28988fd3e07bb461bd483.zip |
tipc: Fix potential OOB in tipc_link_proto_rcv()
[ 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>
-rw-r--r-- | net/tipc/link.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 0d2ee4eb131f..ee4aca974622 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1595,7 +1595,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); |