]> git.baikalelectronics.ru Git - kernel.git/commit
s390/qeth: fix potential deadlock on workqueue flush
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 20 Nov 2019 13:20:56 +0000 (14:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Nov 2019 20:29:47 +0000 (12:29 -0800)
commita75ebc661950f73f43965787f2e8ea53502f872e
treeeab9d781313d549f49d10f3af84e7ed78f952166
parent9aa0fbff9a39e7feb615964b19179833f0e8cc2b
s390/qeth: fix potential deadlock on workqueue flush

The L2 bridgeport code uses the coarse 'conf_mutex' for guarding access
to its configuration state.
This can result in a deadlock when qeth_l2_stop_card() - called under the
conf_mutex - blocks on flush_workqueue() to wait for the completion of
pending bridgeport workers. Such workers would also need to aquire
the conf_mutex, stalling indefinitely.

Introduce a lock that specifically guards the bridgeport configuration,
so that the workers no longer need the conf_mutex.
Wrapping qeth_l2_promisc_to_bridge() in this fine-grained lock then also
fixes a theoretical race against a concurrent qeth_bridge_port_role_store()
operation.

Fixes: 4a850d20b2df ("s390/qeth: conclude all event processing before offlining a card")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l2_sys.c