Commit cc284ecd authored by MichelleJin's avatar MichelleJin Committed by Zheng Zengkai
Browse files

net: ipv6: fix use after free of struct seg6_pernet_data

mainline inclusion
from mainline-v5.16-rc1
commit 23b08260
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I55ZC1
CVE: NA
backport: openEuler-22.03-LTS

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23b08260481ca552180130bbef0f3a60df4c092e



--------------------------------

sdata->tun_src should be freed before sdata is freed
because sdata->tun_src is allocated after sdata allocation.
So, kfree(sdata) and kfree(rcu_dereference_raw(sdata->tun_src)) are
changed code order.

Fixes: f04ed7d2 ("net: ipv6: check return value of rhashtable_init")

Signed-off-by: default avatarMichelleJin <shjy180909@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarXu Jia <xujia39@huawei.com>
Reviewed-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent bea0127a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment