Message ID | 20211022034417.766659-1-wanghai38@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Bluetooth: cmtp: fix possible panic when cmtp_init_sockets() fails | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Single patches do not need cover letters |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 10 of 10 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Fixes tag looks correct |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 15 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | No static functions without inline keyword in header files |
Hi Wang, > 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: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Reported-by: Hulk Robot <hulkci@huawei.com> > Signed-off-by: Wang Hai <wanghai38@huawei.com> > --- > net/bluetooth/cmtp/core.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c > index 0a2d78e811cf..ccf48f50afdf 100644 > --- a/net/bluetooth/cmtp/core.c > +++ b/net/bluetooth/cmtp/core.c > @@ -499,11 +499,13 @@ int cmtp_get_conninfo(struct cmtp_conninfo *ci) > > static int __init cmtp_init(void) > { > + int err; > + > BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); > > - cmtp_init_sockets(); > + err = cmtp_init_sockets(); > > - return 0; > + return err; > } just do return cmtp_init_sockets(); Regards Marcel
在 2021/10/22 12:48, Marcel Holtmann 写道: > Hi Wang, > >> 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: 1da177e4c3f4 ("Linux-2.6.12-rc2") >> Reported-by: Hulk Robot <hulkci@huawei.com> >> Signed-off-by: Wang Hai <wanghai38@huawei.com> >> --- >> net/bluetooth/cmtp/core.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c >> index 0a2d78e811cf..ccf48f50afdf 100644 >> --- a/net/bluetooth/cmtp/core.c >> +++ b/net/bluetooth/cmtp/core.c >> @@ -499,11 +499,13 @@ int cmtp_get_conninfo(struct cmtp_conninfo *ci) >> >> static int __init cmtp_init(void) >> { >> + int err; >> + >> BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); >> >> - cmtp_init_sockets(); >> + err = cmtp_init_sockets(); >> >> - return 0; >> + return err; >> } > just do return cmtp_init_sockets(); > > Regards > > Marcel Ok, I will send v2 > . >
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 0a2d78e811cf..ccf48f50afdf 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -499,11 +499,13 @@ int cmtp_get_conninfo(struct cmtp_conninfo *ci) static int __init cmtp_init(void) { + int err; + BT_INFO("CMTP (CAPI Emulation) ver %s", VERSION); - cmtp_init_sockets(); + err = cmtp_init_sockets(); - return 0; + return err; } static void __exit cmtp_exit(void)
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: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> --- net/bluetooth/cmtp/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)