提交 817aed12 编写于 作者: W Wang Hai 提交者: Zheng Zengkai

Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails

stable inclusion
from stable-v5.10.94
commit 88f1b613c37fbd3c4171f5a9decdcd12ae704637
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

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

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

[ Upstream commit 2a7ca745 ]

I got a kernel BUG report when doing fault injection test:

------------[ cut here ]------------
kernel BUG at lib/list_debug.c:45!
...
RIP: 0010:__list_del_entry_valid.cold+0x12/0x4d
...
Call Trace:
 proto_unregister+0x83/0x220
 cmtp_cleanup_sockets+0x37/0x40 [cmtp]
 cmtp_exit+0xe/0x1f [cmtp]
 do_syscall_64+0x35/0xb0
 entry_SYSCALL_64_after_hwframe+0x44/0xae

If cmtp_init_sockets() in cmtp_init() fails, cmtp_init() still returns
success. This will cause a kernel bug when accessing uncreated ctmp
related data when the module exits.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NWang Hai <wanghai38@huawei.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 ae7f75cc
...@@ -501,9 +501,7 @@ static int __init cmtp_init(void) ...@@ -501,9 +501,7 @@ static int __init cmtp_init(void)
{ {
BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION);
cmtp_init_sockets(); return cmtp_init_sockets();
return 0;
} }
static void __exit cmtp_exit(void) static void __exit cmtp_exit(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册