From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 63386377A94 for ; Fri, 7 Aug 2026 11:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786102880; cv=none; b=s1VKD+5EuOh2muo9zO7Dags6QhE0sRgYlFhlq1q1JGsQKh/TUYhBRFXXDDHJdyfHNkqA40xZyJup/+uDB5FXrUMeRtcU7E1ZCabIC23ETqAUomN21oMYUR+0Tb3AcKfTt6EjjfnSZWnZNzkekC+zz1fxgNG3GvoJsPk5i/qcDmI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786102880; c=relaxed/simple; bh=8bhM35trSjwyI7y2oOmhHz/pfllNgGqcFi0+UFQMAo0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RVAQ7VWPctkWroh0aKS4L28Xo71OeOHertx8l9eFckFIT+mE5ffAr72Byv3C50/OznaBDI+VuCo6jIzax6P2uoEfyXOQYJJvyTqPSWP4dWS+vW0YgMsmB1hJnSh3bkWXt4nBiDIDnCCMcQDG7NGL1qeqOzxG/sWTF8ZVjNCSPc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=E/00tM+0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=KWG6ctof; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="E/00tM+0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="KWG6ctof" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6777odbY3533330 for ; Fri, 7 Aug 2026 11:41:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= S+SG0Jgv2EUKUBJkzppL8BN75gHan5rEkLCYQkb251Y=; b=E/00tM+0mYwdrnBn 6Ee2E4uQDZMg5fPCHStpCPXgQ27lqK807BMWCO4tzp3xPYr8Z1UqUlrZEOgfBwTd alVDizgvOpilfkXqmGvRm+r2LZwOH8QSHg1p/OciL5ZMILpaC5BaJAbfCcXxV+/s BK/3kd+6yLqqzfji6WNdfz0+wG7JKO4CeklBQBotQyjf7tere9q2o6TKpxfZf6Fy CZepJakaJiTSthYyAkA3DeCus3vAVM80hIlQ5Z9SE/YGWRJNA5WoQS3WiWZNBr3x NZrv3bAco5bhRuB0WitYD+Jcx9xwsyxW/1FK2/AGtjULPylWQlwA/tT/zxrCX7xM p8N+IQ== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fvy6futa7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 07 Aug 2026 11:41:09 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38ce7fabf76so5255062a91.2 for ; Fri, 07 Aug 2026 04:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786102869; x=1786707669; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=S+SG0Jgv2EUKUBJkzppL8BN75gHan5rEkLCYQkb251Y=; b=KWG6ctofYqq8z7YIG2+sY18iOrGcjaWJ4wGJ3BBR4dG7xczy5CcZuzWHjpM6GxIvp7 6lhtT9J4xSBSmr8XyTg6L5loxVoQOG+QlitA7KVklE/z+/kwGtZJd0NF1aHbwlALsPyD uT47lB3gEOGL3Y7AZHuxlrRrromn4lnzoFC7yx8ZwtbQgFHNxXhcRhlffF9Corod50n4 mhss3enJVtSPfIAwagl6j++xQSm2US5li77W5v/efAXUGfpJEFJB10QlD9Dx3VldO3vp 1S+O+P32sV5T126Yv93/zZ42PF+HUrmDxdN1SkERYyE6TCr6/w34Ms19VcUxyn4E2dLm F7VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786102869; x=1786707669; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=S+SG0Jgv2EUKUBJkzppL8BN75gHan5rEkLCYQkb251Y=; b=ZEi6MPqoHmN/rGXmp8/HKjDR5QfYQyyD/capmBCzvblWdaCXA0DNJICkUFTtJXx30C iELV4wgZDt4LdZSlRPEm3Lo7FThgAIAXNYgmwHjHKgoIh5wmd5BGHMlHTfmunu3L5/Lm vDLl3Rf4ct9d86DOft/o7XyZ54BB7RdxApKrdpCvdhG2IHdg/cxmDV2/LfWtTA0onhuY X5eOYFzwllxSg517w/uAK94QlC++q2Zs45kUUxxt4w00rJEFx+vajcWMg1heblQJycJc 6+tOLLhpso5Tc5PabjbH0zw8tiSK0CtPMFB58oQ2elw+LV3tMGaCwV+EdnU+r5batHD5 I18Q== X-Forwarded-Encrypted: i=1; AHgh+Rqun7fcxVTsLouc8bEN72wE2WlofLLybsCAV7SkZatWvHZmOUT0rpGQsB87ZgJykDHxZW0Bo1nDsXaZ6hc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+3nAqRjED9fQ3g2T9Vkh7FSZXSekIjjGWIZCL4r3LLYuJWrlb 0kCuKntEMukr++bacBBgGszqr/IFGTx+pj5nY9tpzilFxjfME/w7BPhKZ1XvcOluh1n15zbCI/w YsNRcHZaRqElz/pnC3pLT7p1TCxxtlMnElbrR4gyUd+1104i8p+hy+307XWrVXeQBmc4= X-Gm-Gg: AR+sD10dJxG3mLxoTGqdqRmPbabIMl+q8wHRSmcVE7pmZn9+b1mntCljRYiDizqmFxY ZeWHK6Vt1SWFUm0VRhWlYn21cicBsLwH1ZjQKRUKB2a3vNL/eqcmxrSW7v8nzaIS98ZPPO4R5zX LJwl5/2HThfx3PmRDUKf6gOsMhBXfs0e9uomusl6rGPjVGD/vHs4kQK7tmwMUWHiGLxTJ+rddrm t+89JW7mGMerKfaEAXlFwiiT+qD4w/OHRfWX5BBDyQ2ptRYmcUuQgNnlyOwUPNfkOzPcxOZkV75 kv4NMC0VpexZ4R/jOR/L9LHdPzHxaP7NWD2jsxAPxd1IzPb4CnP4ca8itXfQDv6HzcdZavypvZ0 sqRGaApmJOUp1d0bNnFF3d6Pn0p3LSpk= X-Received: by 2002:a17:90b:4f91:b0:38e:4114:d8c7 with SMTP id 98e67ed59e1d1-3903ba0745emr19462063a91.0.1786102868560; Fri, 07 Aug 2026 04:41:08 -0700 (PDT) X-Received: by 2002:a17:90b:4f91:b0:38e:4114:d8c7 with SMTP id 98e67ed59e1d1-3903ba0745emr19461456a91.0.1786102863340; Fri, 07 Aug 2026 04:41:03 -0700 (PDT) Received: from [10.218.9.97] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39085c393d5sm4737908a91.0.2026.08.07.04.40.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2026 04:41:02 -0700 (PDT) Message-ID: Date: Fri, 7 Aug 2026 17:10:56 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] dmaengine: qcom: gpi: Fix channel cleanup in unwind path To: Aniket Randive , Vinod Koul Cc: Frank Li , Dmitry Baryshkov , Kees Cook , Icenowy Zheng , Jyothi Kumar Seerapu , Miaoqian Lin , linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260803120316.2703956-1-aniket.randive@oss.qualcomm.com> Content-Language: en-US From: Mukesh Savaliya In-Reply-To: <20260803120316.2703956-1-aniket.randive@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA3MDA5MCBTYWx0ZWRfX2oTw8VjrG0ei /ua7dfcyK6TxTZ2lUakCbTcmRhp2Tbbupdc2q/6AgudwsRq1jW2od4FAa+8dgpZxTlw504rLQgN GQ2H1p/12AerM/dDjQJ+fKtGykAGLi3vzUC5jvPQ00j0JNeUGcnRHJK2wiMU0qhcFPSmq+A/dc0 7Hu8RusdLEtxLpSFEi4ayc3rAlhABGToXA5Gz5azCp2iEhhiBfQuwPUw5mWU7qsKlHgeDpBNROa Ns3HCzbhRGalFO4RxeSMMVKZ5DHHEN2gyQxH49KZJ8PDGkSJLfHsbooykw4OE8n0ERo0+eVWHNU OLRe8ZbCCCvlKckdZL9poqCTdTWjBN5JaO3EHTbZkAYp6OSZOvNZ/IT66i/Kzs/7pxT9FwGQY0I 0AoTBlFPvL2VGLIMREJIu78UKh+yuOMkGWPYZx4/2q9GQBOMw3NhI53gVzJPhwCVovkcGUiOSNI BeffLCEXTmMfAjxz5ew== X-Authority-Analysis: v=2.4 cv=DvhmPm/+ c=1 sm=1 tr=0 ts=6a75c455 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=kkqF2vAvHruJUMYZjVUA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: VwhRtsrApt5-pYDoQd19KwW9FC2pEMlU X-Proofpoint-GUID: VwhRtsrApt5-pYDoQd19KwW9FC2pEMlU X-Proofpoint-Spam-Info: AW1haW4tMjYwODA3MDA5MCBTYWx0ZWRfX5cdsiojK9bLl l1oWi5x96Ok0oubJFLn8gsJIVAVSuJwd4pquRolSkiSshCWt8SZxXXmWHmVKivb08/C3/h3rZf9 919kqxIEL7hF/BSVCgx4ncU3L/OqOmU= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-07_01,2026-08-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608070090 On 8/3/2026 5:33 PM, Aniket Randive wrote: > Fix three issues in the gpi_ch_init() error path. > start here mentioning the three problems first in generic way. > Use the indexed channel in the error_start_chan and > error_alloc_chan unwind loops instead of the original gchan > pointer. Otherwise, each iteration operates on the same channel, > leaving sibling channels unreset and undeallocated on failure. meaning, channel cleanup not happened ? make it simpler anyway. > > Clear pm_state after freeing the event ring in the error path. > gpi_alloc_ev_chan() sets pm_state to ACTIVE_STATE, but the error > path frees ev_ring without restoring pm_state. As a result, > gpi_free_chan_resources() may attempt to deallocate an already > freed event ring and issue a redundant EV_CMD_DEALLOC. > Looking at your change, it looks we are cleaning up gpii iterating over each channel along with setting proper state. Code seems simpler than the commit log, so request you to simplify. > Also free ch_ring in gpi_alloc_chan_resources() if gpi_ch_init() > fails. The ring is allocated before calling gpi_ch_init(), so a > failure leaves it leaked without this free. > > Fix all three issues by unwinding the correct channels, restoring > pm_state to DISABLE_STATE after freeing the event ring, and freeing > ch_ring on gpi_ch_init() failure. > > Signed-off-by: Aniket Randive > --- > drivers/dma/qcom/gpi.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c [...]