]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
s390/qeth: fix tear down of async TX buffers
authorJulian Wiedmann <jwi@linux.ibm.com>
Fri, 20 Nov 2020 09:09:39 +0000 (10:09 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 Nov 2020 02:59:48 +0000 (18:59 -0800)
commit7ed10e16e50daf74460f54bc922e27c6863c8d61
treea5c7bbf58c97b30de05fc55a028b56af35b3483a
parent8908f36d20d8ba610d3a7d110b3049b5853b9bb1
s390/qeth: fix tear down of async TX buffers

When qeth_iqd_tx_complete() detects that a TX buffer requires additional
async completion via QAOB, it might fail to replace the queue entry's
metadata (and ends up triggering recovery).

Assume now that the device gets torn down, overruling the recovery.
If the QAOB notification then arrives before the tear down has
sufficiently progressed, the buffer state is changed to
QETH_QDIO_BUF_HANDLED_DELAYED by qeth_qdio_handle_aob().

The tear down code calls qeth_drain_output_queue(), where
qeth_cleanup_handled_pending() will then attempt to replace such a
buffer _again_. If it succeeds this time, the buffer ends up dangling in
its replacement's ->next_pending list ... where it will never be freed,
since there's no further call to qeth_cleanup_handled_pending().

But the second attempt isn't actually needed, we can simply leave the
buffer on the queue and re-use it after a potential recovery has
completed. The qeth_clear_output_buffer() in qeth_drain_output_queue()
will ensure that it's in a clean state again.

Fixes: 72861ae792c2 ("qeth: recovery through asynchronous delivery")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/s390/net/qeth_core_main.c