Commit 8d645f0e authored by Tong Zhang's avatar Tong Zhang Committed by Zheng Zengkai
Browse files

epic100: fix use after free on rmmod

stable inclusion
from stable-v5.10.129
commit b8def021ac7086202f26fdce55471db4794ec76f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5YNDQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b8def021ac7086202f26fdce55471db4794ec76f



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

commit 8ee9d82c upstream.

epic_close() calls epic_rx() and uses dma buffer, but in epic_remove_one()
we already freed the dma buffer. To fix this issue, reorder function calls
like in the .probe function.

BUG: KASAN: use-after-free in epic_rx+0xa6/0x7e0 [epic100]
Call Trace:
 epic_rx+0xa6/0x7e0 [epic100]
 epic_close+0xec/0x2f0 [epic100]
 unregister_netdev+0x18/0x20
 epic_remove_one+0xaa/0xf0 [epic100]

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Reported-by: default avatarYilun Wu <yiluwu@cs.stonybrook.edu>
Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
Reviewed-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
Link: https://lore.kernel.org/r/20220627043351.25615-1-ztong0001@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 60fbc307
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment