linux-stable/net/smc
Chen Zhongjin c97daf836f net/smc: Fix possible leaked pernet namespace in smc_init()
[ Upstream commit 62ff373da2 ]

In smc_init(), register_pernet_subsys(&smc_net_stat_ops) is called
without any error handling.
If it fails, registering of &smc_net_ops won't be reverted.
And if smc_nl_init() fails, &smc_net_stat_ops itself won't be reverted.

This leaves wild ops in subsystem linkedlist and when another module
tries to call register_pernet_operations() it triggers page fault:

BUG: unable to handle page fault for address: fffffbfff81b964c
RIP: 0010:register_pernet_operations+0x1b9/0x5f0
Call Trace:
  <TASK>
  register_pernet_subsys+0x29/0x40
  ebtables_init+0x58/0x1000 [ebtables]
  ...

Fixes: 194730a9be ("net/smc: Make SMC statistics network namespace aware")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Link: https://lore.kernel.org/r/20221101093722.127223-1-chenzhongjin@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-10 18:17:22 +01:00
..
af_smc.c net/smc: Fix possible leaked pernet namespace in smc_init() 2022-11-10 18:17:22 +01:00
Kconfig
Makefile
smc.h
smc_cdc.c
smc_cdc.h
smc_clc.c
smc_clc.h
smc_close.c
smc_close.h
smc_core.c net/smc: Fix an error code in smc_lgr_create() 2022-10-29 10:08:32 +02:00
smc_core.h net/smc: Fix possible access to freed memory in link clear 2022-09-07 16:00:48 +01:00
smc_diag.c net/smc: Enable module load on netlink usage 2022-07-27 13:24:42 +01:00
smc_ib.c
smc_ib.h
smc_ism.c net/smc: Pass on DMBE bit mask in IRQ handler 2022-07-27 13:24:42 +01:00
smc_ism.h
smc_llc.c
smc_llc.h
smc_netlink.c
smc_netlink.h
smc_netns.h
smc_pnet.c
smc_pnet.h
smc_rx.c
smc_rx.h
smc_stats.c
smc_stats.h
smc_sysctl.c
smc_sysctl.h
smc_tracepoint.c
smc_tracepoint.h
smc_tx.c
smc_tx.h
smc_wr.c net/smc: Fix possible access to freed memory in link clear 2022-09-07 16:00:48 +01:00
smc_wr.h net/smc: Fix possible access to freed memory in link clear 2022-09-07 16:00:48 +01:00