Commit 7880325c authored by Fabio M. De Francesco's avatar Fabio M. De Francesco Committed by Zheng Zengkai
Browse files

net/smc: Use a mutex for locking "struct smc_pnettable"

stable inclusion
from stable-v5.10.103
commit 91f56a85278ebd6440ded1a6f82a9706cfcb0a7f
bugzilla: https://gitee.com/openeuler/kernel/issues/I56NE7

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



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

commit 7ff57e98 upstream.

smc_pnetid_by_table_ib() uses read_lock() and then it calls smc_pnet_apply_ib()
which, in turn, calls mutex_lock(&smc_ib_devices.mutex).

read_lock() disables preemption. Therefore, the code acquires a mutex while in
atomic context and it leads to a SAC bug.

Fix this bug by replacing the rwlock with a mutex.

Reported-and-tested-by: default avatar <syzbot+4f322a6d84e991c38775@syzkaller.appspotmail.com>
Fixes: 64e28b52 ("net/smc: add pnet table namespace support")
Confirmed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
Signed-off-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
Acked-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Link: https://lore.kernel.org/r/20220223100252.22562-1-fmdefrancesco@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 avatarYu Liao <liaoyu15@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 1075f83c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment