From nobody Sat Oct 4 06:33:12 2025 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 61DF72DC34E; Wed, 20 Aug 2025 09:08:14 +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=1755680895; cv=none; b=EF3oOkFI+6kl7l9nMBDWY66mn6D8M1G9K4pOWHNsadJdXD0P3fQzNlqnY+p+C+tyOeitOkFCuCQXq9QLUMGdUwNCiRMWn7T6WyQlmq1PoLIAMzyy64NnjSiTguD4umOZ6IBVnxHsdoMRn9eL/7wbcIY6CwujN/6t/UrFSMz2wY0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755680895; c=relaxed/simple; bh=6lnoT2bxuSitJvWa8XfZ/AuaHSSJ9uP6CosWqPhEWIY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=R8r7EfSq8iak4A7COaJotJXxNSwFuuH09OF7aVfm0oIg/b/JRG9hiZG2cCKVzOGRK5Rcw/Q31kluBjwk5MkBIW6lO7RFdF0a1OUKudoLAOqERu6yxK9jxEWC8alv03748aK7skSpo5xoYAHEz5IsY1vzGGrDoyv03/9KafYAwcY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eb8ZUaWU; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eb8ZUaWU" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57K1owKu002743; Wed, 20 Aug 2025 09:08:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ShDpKRPOdED+3EQK0Ut0gkcrHVmGm35whpFDh+hbndU=; b=eb8ZUaWUXhdWz0Se Zfj2JDhvhX29thr71MZ8uyssXu7WcQ73usdy0ZEmgbeIntmxtlkyPj5ShAxSc4Qt 0sBSOviCd39yNNS2LE1YH2IWeV5Kf0uIxVHdinTAJRkpLkQJH4eBlgjawijRQ1is 12e4WEPgXFx8q03K+/dO5nG8x90CkmdP2/cdlWrWzBuYwYtuSvr8F5+baNmEhb6S iy2DwdkxxO+dIx1z/IPxyXH6Ea09mZkMm+Lpa6n1Lsv7+IzP7RyJA/JGmQkg413u pi76dLb9Enm8VGdBFgRuvSeV/aXjx1fx1ZgzNJsyb8QNKXyYj9d73kG4VzBJdjEH zglhYg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48n528s3k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Aug 2025 09:08:04 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 57K983mZ026426 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Aug 2025 09:08:03 GMT Received: from hu-dikshita-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Wed, 20 Aug 2025 02:07:59 -0700 From: Dikshita Agarwal Date: Wed, 20 Aug 2025 14:37:41 +0530 Subject: [PATCH v3 03/26] media: iris: Fix memory leak by freeing untracked persist buffer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250820-iris-video-encoder-v3-3-80ab0ba58b3d@quicinc.com> References: <20250820-iris-video-encoder-v3-0-80ab0ba58b3d@quicinc.com> In-Reply-To: <20250820-iris-video-encoder-v3-0-80ab0ba58b3d@quicinc.com> To: Vikash Garodia , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Stefan Schmidt , Vedang Nagar , "Hans Verkuil" , Hans Verkuil CC: , , , Renjiang Han , Wangao Wang , Dikshita Agarwal X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1755680867; l=1425; i=quic_dikshita@quicinc.com; s=20240917; h=from:subject:message-id; bh=6lnoT2bxuSitJvWa8XfZ/AuaHSSJ9uP6CosWqPhEWIY=; b=PFQegAFPZT0bHZXd2jNBuommJfNBLPx+dzSRznUbrFm8uSjlJqQmXUeyOdYrCxgqk3HB9pszH EuPgOn1hQL+BUi/d4KFa0QE6VHLjIPlSOftwebsGbq+bnm5h75+TV9D X-Developer-Key: i=quic_dikshita@quicinc.com; a=ed25519; pk=EEvKY6Ar1OI5SWf44FJ1Ebo1KuQEVbbf5UNPO+UHVhM= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Authority-Analysis: v=2.4 cv=fpOFpF4f c=1 sm=1 tr=0 ts=68a59074 cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=COk6AnOGAAAA:8 a=GUxkLdxIJ5orBtzUV8IA:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-GUID: wrtRQDCYYQjitA5hV3c179GTr8vUkjZq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIwMDAxMyBTYWx0ZWRfX8PD90UgVM4kV UQrGsg0wF9P58fksUsZaM3Fk26GIztBWVFORVVES94UV5+TClU4sQd9nwjMu4r3NGZqNM7emVpm PBctqgxRJNu5lQBWE9+5W7KBpHUXEcX0iKCBhnGdqpyDVPiT/Tw1GTjBYEAzgEkXGNGcnWyQ32d rMyG/jPuU8MX3RPluxWQugxbNFPaS4+U4tllUilu+3jUZ2OTbKkbviIcSioNbYWK3RswKBWtkUN UjMoeicQaI+F4zXKVPhI9P2cx7XugjQSwmAMCQo4wCoOCL9j7AxFV2p4w11M09/YmViWLgy5k6N n8NQHWvT6jexzUoQQb+6twzbMFjYRsUFhePPp1R4Lqd9dXbn2vRUzWlYNZA01WZM2MsVd06M6EC G/Is1eUiaUYl+3HQpTvRNCGnuTXp3g== X-Proofpoint-ORIG-GUID: wrtRQDCYYQjitA5hV3c179GTr8vUkjZq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-20_03,2025-08-20_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200013 One internal buffer which is allocated only once per session was not being freed during session close because it was not being tracked as part of internal buffer list which resulted in a memory leak. Add the necessary logic to explicitly free the untracked internal buffer during session close to ensure all allocated memory is released properly. Fixes: 73702f45db81 ("media: iris: allocate, initialize and queue internal = buffers") Reviewed-by: Vikash Garodia Tested-by: Vikash Garodia # X1E80100 Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/iris/iris_buffer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media= /platform/qcom/iris/iris_buffer.c index 6425e4919e3b0b849ba801ca9e01921c114144cd..9f664c241149362d44d3a8fa65e= 2266f9c2e80e0 100644 --- a/drivers/media/platform/qcom/iris/iris_buffer.c +++ b/drivers/media/platform/qcom/iris/iris_buffer.c @@ -413,6 +413,16 @@ static int iris_destroy_internal_buffers(struct iris_i= nst *inst, u32 plane, bool } } =20 + if (force) { + buffers =3D &inst->buffers[BUF_PERSIST]; + + list_for_each_entry_safe(buf, next, &buffers->list, list) { + ret =3D iris_destroy_internal_buffer(inst, buf); + if (ret) + return ret; + } + } + return 0; } =20 --=20 2.34.1