Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8A9C38837C; Sat, 12 Sep 2026 13:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218859; cv=none; b=kRP22K8hXTQrderPivuDko0GQOjkJAC25gxXY2MmTDF8NNoxuCDOmuqL/ZOtW3xEC25xFkXx7zhZsuOm5FHbzvnrqoCaDeAL0LupJgHmaf7ZKk23HMKBz0js5qK1xd5VanUv092sQFN4yd+G0NGVv5QdZ/egWHa+8+aBlu7IKws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789218859; c=relaxed/simple; bh=fKv1R2COgMZvDBIvd/ljDqRnD2sRfK1JGQweKHPc2wM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P8rHwD86lLJFU6ju6toIjbHkjnC7Mi3wS33nFepvvw0GKi2TsxYYs/iRPA7Q42wGo6PXBzhQVaNswdY/Pti0OXa23z4fKAJnDBEGo14zIsSkhYmJ8Xhu4DVufjPMIy6T5J/urDeEcPAb4E5lLB67nevJdt1YKkW/i9+ox4nrmm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1aiRPr9l; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="1aiRPr9l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70D9C1F000FF; Sat, 12 Sep 2026 13:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789218858; bh=XGsTFSoX/CZgPxOT5uJuq5/rr7/5Qd6x7oYNayVbYhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1aiRPr9lwi0xVnnNZdW7SPwMPsSD4KxToltELefO0ViGFNA1i2GrIRCZ3n5kWVKhq ArKKfnyakmqQLSY0pLQf1FBYB1hmShbbsHJDnEA4IqMVZAc5ijH7Zw5UZlKyk+jMIK SiOQnR1Qlrt2o1qh6DiuVL/9ZPinYjsnw5n9BzMs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Li RongQing , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Dragos Tatulea , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 6.12 1231/1376] vdpa/mlx5: fix wrong list iterated in add_direct_chain error path Date: Sat, 12 Sep 2026 09:00:57 +0200 Message-ID: <20260912065634.981197578@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Li RongQing [ Upstream commit 23ae56d9e74c122f95cae71ae3b9fc259fb88446 ] 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 Acked-by: Eugenio Pérez Reviewed-by: Dragos Tatulea Signed-off-by: Michael S. Tsirkin Message-ID: <20260701113608.1972-1-lirongqing@baidu.com> Signed-off-by: Sasha Levin --- 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 27abbe69b55cd..25e2c234bcef2 100644 --- a/drivers/vdpa/mlx5/core/mr.c +++ b/drivers/vdpa/mlx5/core/mr.c @@ -482,7 +482,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); -- 2.53.0