]> git.baikalelectronics.ru Git - kernel.git/commit
s390/qeth: fix locking for discipline setup / removal
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 7 Jan 2021 17:24:41 +0000 (18:24 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 Jan 2021 02:54:06 +0000 (18:54 -0800)
commitaec9f46caab20b83022016765084663a59c441fc
tree640acf6ee4ddeb467d832a99b68242f35deaa7ae
parent0b42b521db589c473edd3a93b83732ba1da23483
s390/qeth: fix locking for discipline setup / removal

Due to insufficient locking, qeth_core_set_online() and
qeth_dev_layer2_store() can run in parallel, both attempting to load &
setup the discipline (and stepping on each other toes along the way).
A similar race can also occur between qeth_core_remove_device() and
qeth_dev_layer2_store().

Access to .discipline is meant to be protected by the discipline_mutex,
so add/expand the locking in qeth_core_remove_device() and
qeth_core_set_online().
Adjust the locking in qeth_l*_remove_device() accordingly, as it's now
handled by the callers in a consistent manner.

Based on an initial patch by Ursula Braun.

Fixes: 5ade8c676c59 ("qeth: serialize sysfs-triggered device configurations")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c