From: Dave Marquardt <davemarq@linux.ibm.com>
To: Mingming Cao <mmc@linux.ibm.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
horms@kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, nnac123@linux.ibm.com,
maddy@linux.ibm.com, mpe@ellerman.id.au,
linuxppc-dev@lists.ozlabs.org, bjking1@linux.ibm.com,
shaik.abdulla1@ibm.com, stable@vger.kernel.org
Subject: Re: [PATCH net 2/2] ibmveth: fix TX LTB and filter unwind on open-fail
Date: Fri, 25 Sep 2026 14:08:08 -0500 [thread overview]
Message-ID: <87fqyx1753.fsf@linux.ibm.com> (raw)
In-Reply-To: <d14314c2b10f125f5e578782484ba3cc50564d53.1790357373.git.mmc@linux.ibm.com> (Mingming Cao's message of "Fri, 25 Sep 2026 11:05:30 -0700")
Mingming Cao <mmc@linux.ibm.com> writes:
> out_free_buffer_pools reuses open()'s loop index for the TX LTB
> walk. After the pool unwind i is -1, so the TX buffers allocated
> earlier are leaked. request_irq() failure has the same leak.
>
> The TX-fail goto on that walk also skips dma_unmap of the filter
> list (pre-existing since the LTB was added). Rewrite the TX walk
> to real_num_tx_queues with a pointer check, and unmap the filter
> list before those frees.
>
> Fixes: d926793c1de9 ("ibmveth: Implement multi queue on xmit")
> Cc: stable@vger.kernel.org
> Signed-off-by: Mingming Cao <mmc@linux.ibm.com>
> ---
> drivers/net/ethernet/ibm/ibmveth.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index 3e44f6b714d4..abebdb1fc262 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -553,10 +553,15 @@ static int ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter,
>
> static void ibmveth_free_tx_ltb(struct ibmveth_adapter *adapter, int idx)
> {
> + void *ptr = adapter->tx_ltb_ptr[idx];
> +
> + if (!ptr)
> + return;
> +
> + adapter->tx_ltb_ptr[idx] = NULL;
> dma_unmap_single(&adapter->vdev->dev, adapter->tx_ltb_dma[idx],
> adapter->tx_ltb_size, DMA_TO_DEVICE);
> - kfree(adapter->tx_ltb_ptr[idx]);
> - adapter->tx_ltb_ptr[idx] = NULL;
> + kfree(ptr);
> }
>
> static int ibmveth_allocate_tx_ltb(struct ibmveth_adapter *adapter, int idx)
> @@ -667,7 +672,7 @@ static int ibmveth_open(struct net_device *netdev)
>
> for (i = 0; i < netdev->real_num_tx_queues; i++) {
> if (ibmveth_allocate_tx_ltb(adapter, i))
> - goto out_free_tx_ltb;
> + goto out_unmap_filter_list;
> }
>
> adapter->rx_queue.index = 0;
> @@ -745,10 +750,8 @@ static int ibmveth_open(struct net_device *netdev)
> dma_unmap_single(dev, adapter->filter_list_dma, 4096,
> DMA_BIDIRECTIONAL);
>
> -out_free_tx_ltb:
> - while (--i >= 0) {
> + for (i = netdev->real_num_tx_queues - 1; i >= 0; i--)
> ibmveth_free_tx_ltb(adapter, i);
> - }
>
> out_unmap_buffer_list:
> dma_unmap_single(dev, adapter->buffer_list_dma, 4096,
Reviewed-by: Dave Marquardt <davemarq@linux.ibm.com>
next prev parent reply other threads:[~2026-09-25 19:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 18:05 [PATCH net 0/2] ibmveth: fix open-fail unwind after LAN registration Mingming Cao
2026-09-25 18:05 ` [PATCH net 1/2] ibmveth: h_free logical LAN on open-fail after register Mingming Cao
2026-09-25 19:01 ` Dave Marquardt
2026-09-25 19:48 ` mingming cao
2026-09-25 20:36 ` Dave Marquardt
2026-09-25 18:05 ` [PATCH net 2/2] ibmveth: fix TX LTB and filter unwind on open-fail Mingming Cao
2026-09-25 19:08 ` Dave Marquardt [this message]
2026-10-01 23:10 ` [PATCH net 0/2] ibmveth: fix open-fail unwind after LAN registration patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fqyx1753.fsf@linux.ibm.com \
--to=davemarq@linux.ibm.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjking1@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mmc@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=pabeni@redhat.com \
--cc=shaik.abdulla1@ibm.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.