]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ip_vti: fix potential slab-use-after-free in decode_session6
authorZhengchao Shao <shaozhengchao@huawei.com>
Mon, 10 Jul 2023 09:40:53 +0000 (17:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:35:12 +0000 (16:35 +0200)
commit82fb41c5de243e7dfa90f32ca58e35adaff56c1d
tree9ec547c442080970112efdf190f7d059d23d8e05
parent0f0ab8d52ee0062b28367dea23c29e254a26d7db
ip_vti: fix potential slab-use-after-free in decode_session6

[ Upstream commit 6018a266279b1a75143c7c0804dd08a5fc4c3e0b ]

When ip_vti device is set to the qdisc of the sfb type, the cb field
of the sent skb may be modified during enqueuing. Then,
slab-use-after-free may occur when ip_vti device sends IPv6 packets.
As commit f855691975bb ("xfrm6: Fix the nexthdr offset in
_decode_session6.") showed, xfrm_decode_session was originally intended
only for the receive path. IP6CB(skb)->nhoff is not set during
transmission. Therefore, set the cb field in the skb to 0 before
sending packets.

Fixes: f855691975bb ("xfrm6: Fix the nexthdr offset in _decode_session6.")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/ip_vti.c