Commit a629731a authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Kleber Sacilotto de Souza

s390/qeth: fix race in used-buffer accounting

BugLink: https://bugs.launchpad.net/bugs/1798587

[ Upstream commit a702349a ]

By updating q->used_buffers only _after_ do_QDIO() has completed, there
is a potential race against the buffer's TX completion. In the unlikely
case that the TX completion path wins, qeth_qdio_output_handler() would
decrement the counter before qeth_flush_buffers() even incremented it.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent f7954aa8
...@@ -3513,13 +3513,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, ...@@ -3513,13 +3513,14 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
qdio_flags = QDIO_FLAG_SYNC_OUTPUT; qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
if (atomic_read(&queue->set_pci_flags_count)) if (atomic_read(&queue->set_pci_flags_count))
qdio_flags |= QDIO_FLAG_PCI_OUT; qdio_flags |= QDIO_FLAG_PCI_OUT;
atomic_add(count, &queue->used_buffers);
rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags, rc = do_QDIO(CARD_DDEV(queue->card), qdio_flags,
queue->queue_no, index, count); queue->queue_no, index, count);
if (queue->card->options.performance_stats) if (queue->card->options.performance_stats)
queue->card->perf_stats.outbound_do_qdio_time += queue->card->perf_stats.outbound_do_qdio_time +=
qeth_get_micros() - qeth_get_micros() -
queue->card->perf_stats.outbound_do_qdio_start_time; queue->card->perf_stats.outbound_do_qdio_start_time;
atomic_add(count, &queue->used_buffers);
if (rc) { if (rc) {
queue->card->stats.tx_errors += count; queue->card->stats.tx_errors += count;
/* ignore temporary SIGA errors without busy condition */ /* ignore temporary SIGA errors without busy condition */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment