]> www.infradead.org Git - users/dwmw2/linux.git/commit
s390/qeth: serialize cmd reply with concurrent timeout
authorJulian Wiedmann <jwi@linux.ibm.com>
Mon, 12 Aug 2019 14:44:35 +0000 (16:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:35:14 +0000 (10:35 +0100)
commitd45c33d890bc2fbe5485c2b0e964485e86dd4f66
tree65f78d8f06ac3ff552a75e0c0f0142865f419d5e
parentb12691c24ea93a10ee66c457b9ca786b193e1777
s390/qeth: serialize cmd reply with concurrent timeout

[ Upstream commit 072f79400032f74917726cf76f4248367ea2b5b8 ]

Callbacks for a cmd reply run outside the protection of card->lock, to
allow for additional cmds to be issued & enqueued in parallel.

When qeth_send_control_data() bails out for a cmd without having
received a reply (eg. due to timeout), its callback may concurrently be
processing a reply that just arrived. In this case, the callback
potentially accesses a stale reply->reply_param area that eg. was
on-stack and has already been released.

To avoid this race, add some locking so that qeth_send_control_data()
can (1) wait for a concurrently running callback, and (2) zap any
pending callback that still wants to run.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c