* [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init
@ 2023-02-27 10:02 void0red
2023-03-13 11:52 ` Leon Romanovsky
2023-03-13 11:53 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: void0red @ 2023-02-27 10:02 UTC (permalink / raw)
To: dennis.dalessandro; +Cc: jgg, leon, linux-rdma, linux-kernel, Kang Chen
From: Kang Chen <void0red@gmail.com>
kzalloc_node may fails, check it and do the cleanup.
Signed-off-by: Kang Chen <void0red@gmail.com>
---
drivers/infiniband/hw/hfi1/ipoib_tx.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hfi1/ipoib_tx.c b/drivers/infiniband/hw/hfi1/ipoib_tx.c
index 5d9a7b09c..349eb4139 100644
--- a/drivers/infiniband/hw/hfi1/ipoib_tx.c
+++ b/drivers/infiniband/hw/hfi1/ipoib_tx.c
@@ -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.avail = hfi1_ipoib_ring_hwat(txq);
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 =
kzalloc_node(sizeof(*tx->sdma_hdr),
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);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init
2023-02-27 10:02 [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init void0red
@ 2023-03-13 11:52 ` Leon Romanovsky
2023-03-13 11:53 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-13 11:52 UTC (permalink / raw)
To: void0red; +Cc: dennis.dalessandro, jgg, linux-rdma, linux-kernel
On Mon, Feb 27, 2023 at 06:02:12PM +0800, void0red wrote:
> From: Kang Chen <void0red@gmail.com>
>
> kzalloc_node may fails, check it and do the cleanup.
>
> Signed-off-by: Kang Chen <void0red@gmail.com>
> ---
> drivers/infiniband/hw/hfi1/ipoib_tx.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Added Fixes line and applied.
Fixes: b1151b74ff68 ("IB/hfi1: Fix alloc failure with larger txqueuelen")
Thanks
>
> diff --git a/drivers/infiniband/hw/hfi1/ipoib_tx.c b/drivers/infiniband/hw/hfi1/ipoib_tx.c
> index 5d9a7b09c..349eb4139 100644
> --- a/drivers/infiniband/hw/hfi1/ipoib_tx.c
> +++ b/drivers/infiniband/hw/hfi1/ipoib_tx.c
> @@ -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.avail = hfi1_ipoib_ring_hwat(txq);
> 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 =
> kzalloc_node(sizeof(*tx->sdma_hdr),
> 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);
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init
2023-02-27 10:02 [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init void0red
2023-03-13 11:52 ` Leon Romanovsky
@ 2023-03-13 11:53 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-13 11:53 UTC (permalink / raw)
To: dennis.dalessandro, void0red; +Cc: jgg, linux-rdma, linux-kernel
On Mon, 27 Feb 2023 18:02:12 +0800, void0red wrote:
> kzalloc_node may fails, check it and do the cleanup.
>
>
Applied, thanks!
[1/1] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init
https://git.kernel.org/rdma/rdma/c/c874ad879c2f29
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-13 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 10:02 [PATCH] IB/hifi1: add a null check of kzalloc_node in hfi1_ipoib_txreq_init void0red
2023-03-13 11:52 ` Leon Romanovsky
2023-03-13 11:53 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox