From nobody Sat Dec 27 01:05:17 2025 Received: from lf-2-39.ptr.blmpb.com (lf-2-39.ptr.blmpb.com [101.36.218.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52E534CB50 for ; Tue, 26 Dec 2023 09:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=semidrive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=semidrive.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=semidrive-com.20200927.dkim.feishu.cn header.i=@semidrive-com.20200927.dkim.feishu.cn header.b="TXTGPZDj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=semidrive-com.20200927.dkim.feishu.cn; t=1703567722; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=vHeWsMfM12kuVaIVTOroSE1f22ig5Ahs9GSqrLGp8P8=; b=TXTGPZDjiEa6rva1LVYiPD8bqUM1aKr+mDf5bK1UqrE84gMYXY9GrjVbIr5JfJVtaCduO9 809Tvsg8ZenA3yKQWcx6/0jlMhWmegSjn0G4IGz3ybfe8V2Of9AhSDrBIksiCCo8MSEC2E Lmn/WyAtfw2oVGG0u10Ckgb7UXEfqfI9wWw7pAtrw8kmyaLUv1W0rnTil3dw4rI+Ee4Yuf pEbSfBDcTq/ZJmu2HRtbazdIjBHYHX8Lpf71AVJ8gB2Za+2JPbPKB7bqS0vzjq52eSZO8O Va80dgttR1k5IMMoGvPog6Af0/G/8pk45Md6wxhYFgHQXnaH1BOJ9w0xhld23Q== Cc: , , From: "yi.shao" Content-Transfer-Encoding: quoted-printable X-Mailer: git-send-email 2.7.4 Subject: [PATCH] dmaengine: virt-dma:fix vchan_dma_desc_free_list list_del corruption. Date: Tue, 26 Dec 2023 13:15:17 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Message-Id: <1703567717-71861-1-git-send-email-yi.shao@semidrive.com> Received: from nj-bsvm040.semidrive.cc ([58.213.129.90]) by smtp.feishu.cn with ESMTPS; Tue, 26 Dec 2023 13:15:20 +0800 To: X-Lms-Return-Path: X-Original-From: "yi.shao" Content-Type: text/plain; charset="utf-8" To resolve the race problem when terminating a cyclic transfer, dmaengine calls vchan_terminate_vdesc() from the DMA terminate_all function. When configuring the CONFIG_DEBUG_LIST macro, it detects a list corruption error in the vchan_dma_desc_free_list function, displaying the following message: "[54.964702] list_del corruption. prev->next should be ffffa0001395a0b8, but it was ffffa000180a7950". This error occurs because the virt_dma_desc remains in the vc->desc_issued list.To resolve this issue, the vchan_terminate_vdesc function should remove the descriptor from vc->desc_issued and then add it to vc->desc_terminated. Signed-off-by: yi.shao --- drivers/dma/virt-dma.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index e9f5250..eee97d2 100644 --- a/drivers/dma/virt-dma.h +++ b/drivers/dma/virt-dma.h @@ -146,6 +146,7 @@ static inline void vchan_terminate_vdesc(struct virt_dm= a_desc *vd) { struct virt_dma_chan *vc =3D to_virt_chan(vd->tx.chan); =20 + list_del(&vd->node); list_add_tail(&vd->node, &vc->desc_terminated); =20 if (vc->cyclic =3D=3D vd) --=20 2.7.4 =E6=B3=A8=E6=84=8F=EF=BC=9A=E6=9C=AC=E7=94=B5=E5=AD=90=E9=82=AE=E4=BB=B6=E6= =88=96=E5=85=B6=E4=BB=BB=E4=BD=95=E9=99=84=E4=BB=B6=E5=B1=9E=E4=BA=8E=E5=8D= =97=E4=BA=AC=E8=8A=AF=E9=A9=B0=E5=8D=8A=E5=AF=BC=E4=BD=93=E7=A7=91=E6=8A=80= =E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8=E5=8F=8A=E5=85=B6=E5=90=84=E5=88=86=E5= =AD=90=E5=85=AC=E5=8F=B8=EF=BC=88=E2=80=9C=E8=8A=AF=E9=A9=B0=E7=A7=91=E6=8A= =80=E2=80=9D=EF=BC=89=E6=89=80=E6=9C=89=E3=80=82=E6=9C=AC=E7=94=B5=E5=AD=90= =E9=82=AE=E4=BB=B6=E6=88=96=E4=BB=BB=E4=BD=95=E9=99=84=E4=BB=B6=E4=BB=85=E4= =BE=9B=E6=94=B6=E4=BB=B6=E4=BA=BA=E6=88=96=E6=94=B6=E4=BB=B6=E5=AE=9E=E4=BD= =93=E4=BD=BF=E7=94=A8=E3=80=82=E6=9C=AC=E7=94=B5=E5=AD=90=E9=82=AE=E4=BB=B6= =E6=88=96=E4=BB=BB=E4=BD=95=E9=99=84=E4=BB=B6=E5=8F=AF=E8=83=BD=E5=8C=85=E5= =90=AB=E8=8A=AF=E9=A9=B0=E7=A7=91=E6=8A=80=E7=9A=84=E6=9C=BA=E5=AF=86=E4=BF= =A1=E6=81=AF=E3=80=82=E7=A6=81=E6=AD=A2=E4=BB=BB=E4=BD=95=E6=9C=AA=E7=BB=8F= =E6=8E=88=E6=9D=83=E4=BD=BF=E7=94=A8=E3=80=81=E5=A4=8D=E5=88=B6=E3=80=81=E4= =BC=A0=E6=92=AD=E6=88=96=E5=9B=A0=E4=BE=9D=E8=B5=96=E6=9C=AC=E7=94=B5=E5=AD= =90=E9=82=AE=E4=BB=B6=E8=80=8C=E9=87=87=E5=8F=96=E6=88=96=E4=B8=8D=E9=87=87= =E5=8F=96=E7=9A=84=E4=BB=BB=E4=BD=95=E5=85=B6=E4=BB=96=E8=A1=8C=E5=8A=A8=E3= =80=82=E5=A6=82=E6=9E=9C=E6=82=A8=E4=B8=8D=E6=98=AF=E6=AD=A4=E7=94=B5=E5=AD= =90=E9=82=AE=E4=BB=B6=E7=9A=84=E9=A2=84=E6=9C=9F=E6=94=B6=E4=BB=B6=E4=BA=BA= =EF=BC=8C=E8=AF=B7=E9=80=9A=E8=BF=87=E5=9B=9E=E5=A4=8D=E7=94=B5=E5=AD=90=E9= =82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5=E5=8F=91=E4=BB=B6=E4=BA=BA=EF=BC=8C=E5=B9= =B6=E4=BB=8E=E6=82=A8=E7=9A=84=E7=B3=BB=E7=BB=9F=E4=B8=AD=E5=88=A0=E9=99=A4= =E6=AD=A4=E9=82=AE=E4=BB=B6=E5=92=8C=E4=BB=BB=E4=BD=95=E9=99=84=E4=BB=B6=E3= =80=82=E9=9D=9E=E5=B8=B8=E6=84=9F=E8=B0=A2=E3=80=82 Attention=EF=BC=9AThis email or any attachments thereof belong to Nanjing S= emidrive Technology Ltd and each of its affiliates and subsidiaries=EF=BC= =88"SemiDrive Group"=EF=BC=89.This email or any attachments are intended on= ly for use by the individual or entity to which it is addressed. This email= or any attachments may contain confidential information of SemiDrive Group= . Any unauthorized use, copying, dissemination or any other action taken or= omitted to be taken in reliance upon this email is prohibited. If you are = not the intended recipient(s) of this email=EF=BC=8CPlease notify the sende= r by reply e-mail and delete the message and any attachments from your syst= em. Thank you.