Commit 46ab3871 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Zhengchao Shao
Browse files

net/smc: remove device from smcd_dev_list after failed device_add()

mainline inclusion
from mainline-v5.13-rc4
commit 444d7be9
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9BGMR
CVE: CVE-2021-47143

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=444d7be9532dcfda8e0385226c862fd7e986f607



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

If the device_add() for a smcd_dev fails, there's no cleanup step that
rolls back the earlier list_add(). The device subsequently gets freed,
and we end up with a corrupted list.

Add some error handling that removes the device from the list.

Fixes: c6ba7c9b ("net/smc: add base infrastructure for SMC-D and ISM")
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>

Conflicts:
	net/smc/smc_ism.c

Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent ce7ba9ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment