]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: remove device from smcd_dev_list after failed device_add()
authorJulian Wiedmann <jwi@linux.ibm.com>
Mon, 17 May 2021 08:47:06 +0000 (10:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 May 2021 22:27:22 +0000 (15:27 -0700)
commit2b31cbed4abb5d212acb594b7d3ea19eca46d1f6
tree61d9d9581696473a934cf6bb16b31c175eddf211
parent508c2d995359378383b8e84c2ece98f08d60f21d
net/smc: remove device from smcd_dev_list after failed device_add()

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: aada6413944e ("net/smc: add base infrastructure for SMC-D and ISM")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_ism.c