From: Dragos Tatulea <dtatulea@nvidia.com>
To: lirongqing <lirongqing@baidu.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Kees Cook" <kees@kernel.org>, "Rosen Penev" <rosenp@gmail.com>,
"Parav Pandit" <parav@mellanox.com>,
"Eli Cohen" <eli@mellanox.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vdpa/mlx5: fix wrong list iterated in add_direct_chain error path
Date: Wed, 1 Jul 2026 17:02:09 +0200 [thread overview]
Message-ID: <e7af1b74-774f-483c-a920-2c1f22e76112@nvidia.com> (raw)
In-Reply-To: <20260701113608.1972-1-lirongqing@baidu.com>
On 01.07.26 13:36, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> In add_direct_chain(), newly allocated direct MR entries are added to
> the local list 'tmp', which is spliced into mr->head only on success.
> On the error path, the cleanup loop was incorrectly iterating over
> mr->head instead of tmp.
>
> Fix by iterating over 'tmp' in the err_alloc cleanup path.
>
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> drivers/vdpa/mlx5/core/mr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index 6d02ccf..1a224f0 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -480,7 +480,7 @@ static int add_direct_chain(struct mlx5_vdpa_dev *mvdev,
> return 0;
>
> err_alloc:
> - list_for_each_entry_safe(dmr, n, &mr->head, list) {
> + list_for_each_entry_safe(dmr, n, &tmp, list) {
> list_del_init(&dmr->list);
> unmap_direct_mr(mvdev, dmr);
> kfree(dmr);
Thanks for your patch!
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Thanks,
Dragos
prev parent reply other threads:[~2026-07-01 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 11:36 [PATCH] vdpa/mlx5: fix wrong list iterated in add_direct_chain error path lirongqing
2026-07-01 13:44 ` Eugenio Perez Martin
2026-07-01 15:02 ` Dragos Tatulea [this message]
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=e7af1b74-774f-483c-a920-2c1f22e76112@nvidia.com \
--to=dtatulea@nvidia.com \
--cc=eli@mellanox.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=rosenp@gmail.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox