Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit ee3bc48

Browse files
julianwiedmanngregkh
authored andcommitted
s390/qeth: handle error when backing RX buffer
[ Upstream commit 17413852804d7e86e6f0576cca32c1541817800e ] qeth_init_qdio_queues() fills the RX ring with an initial set of RX buffers. If qeth_init_input_buffer() fails to back one of the RX buffers with memory, we need to bail out and report the error. Fixes: 4a71df5 ("qeth: new qeth device driver") Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8b6cccd commit ee3bc48

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/s390/net/qeth_core_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,12 +2633,12 @@ static int qeth_init_input_buffer(struct qeth_card *card,
26332633
buf->rx_skb = netdev_alloc_skb(card->dev,
26342634
QETH_RX_PULL_LEN + ETH_HLEN);
26352635
if (!buf->rx_skb)
2636-
return 1;
2636+
return -ENOMEM;
26372637
}
26382638

26392639
pool_entry = qeth_find_free_buffer_pool_entry(card);
26402640
if (!pool_entry)
2641-
return 1;
2641+
return -ENOBUFS;
26422642

26432643
/*
26442644
* since the buffer is accessed only from the input_tasklet
@@ -2670,10 +2670,15 @@ int qeth_init_qdio_queues(struct qeth_card *card)
26702670
/* inbound queue */
26712671
qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q);
26722672
memset(&card->rx, 0, sizeof(struct qeth_rx));
2673+
26732674
qeth_initialize_working_pool_list(card);
26742675
/*give only as many buffers to hardware as we have buffer pool entries*/
2675-
for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i)
2676-
qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]);
2676+
for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; i++) {
2677+
rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]);
2678+
if (rc)
2679+
return rc;
2680+
}
2681+
26772682
card->qdio.in_q->next_buf_to_init =
26782683
card->qdio.in_buf_pool.buf_count - 1;
26792684
rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0,

0 commit comments

Comments
 (0)