mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init
[ Upstream commitc874ad879c] kzalloc_node may fails, check it and do the cleanup. Fixes:b1151b74ff("IB/hfi1: Fix alloc failure with larger txqueuelen") Signed-off-by: Kang Chen <void0red@gmail.com> Link: https://lore.kernel.org/r/20230227100212.910820-1-void0red@gmail.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a2290ed2af
commit
d7c8d32e5d
@@ -737,10 +737,13 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv)
|
|||||||
txq->tx_ring.shift = ilog2(tx_item_size);
|
txq->tx_ring.shift = ilog2(tx_item_size);
|
||||||
txq->tx_ring.avail = hfi1_ipoib_ring_hwat(txq);
|
txq->tx_ring.avail = hfi1_ipoib_ring_hwat(txq);
|
||||||
tx_ring = &txq->tx_ring;
|
tx_ring = &txq->tx_ring;
|
||||||
for (j = 0; j < tx_ring_size; j++)
|
for (j = 0; j < tx_ring_size; j++) {
|
||||||
hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr =
|
hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr =
|
||||||
kzalloc_node(sizeof(*tx->sdma_hdr),
|
kzalloc_node(sizeof(*tx->sdma_hdr),
|
||||||
GFP_KERNEL, priv->dd->node);
|
GFP_KERNEL, priv->dd->node);
|
||||||
|
if (!hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr)
|
||||||
|
goto free_txqs;
|
||||||
|
}
|
||||||
|
|
||||||
netif_napi_add_tx(dev, &txq->napi, hfi1_ipoib_poll_tx_ring);
|
netif_napi_add_tx(dev, &txq->napi, hfi1_ipoib_poll_tx_ring);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user