{"id":2223739,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223739/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260416055501.494002-1-gurumoorthy.santhakumar@oss.qualcomm.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260416055501.494002-1-gurumoorthy.santhakumar@oss.qualcomm.com>","date":"2026-04-16T05:55:01","name":"[v2] usb: dwc3: core: fix memory leaks in event buffer cleanup","commit_ref":"884b10e86a0593db423ae14797c07785a69a8ca2","pull_url":null,"state":"accepted","archived":false,"hash":"a8482a38d62c5d641de1397be506ece74dab63e9","submitter":{"id":93144,"url":"http://patchwork.ozlabs.org/api/1.1/people/93144/?format=json","name":"Gurumoorthy Santhakumar","email":"gurumoorthy.santhakumar@oss.qualcomm.com"},"delegate":{"id":1699,"url":"http://patchwork.ozlabs.org/api/1.1/users/1699/?format=json","username":"marex","first_name":"Marek","last_name":"Vasut","email":"marek.vasut@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260416055501.494002-1-gurumoorthy.santhakumar@oss.qualcomm.com/mbox/","series":[{"id":500077,"url":"http://patchwork.ozlabs.org/api/1.1/series/500077/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=500077","date":"2026-04-16T05:55:01","name":"[v2] usb: dwc3: core: fix memory leaks in event buffer cleanup","version":2,"mbox":"http://patchwork.ozlabs.org/series/500077/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223739/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223739/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=gtAd9NnF;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=ITFNcZtY;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=oss.qualcomm.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com\n header.b=\"gtAd9NnF\";\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=\"ITFNcZtY\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=none (p=none dis=none)\n header.from=oss.qualcomm.com","phobos.denx.de; spf=pass\n smtp.mailfrom=gurumoorthy.santhakumar@oss.qualcomm.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fx6gK6DfJz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 15:55:25 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id C0E1983EEF;\n\tThu, 16 Apr 2026 07:55:16 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 6C5B18407E; Thu, 16 Apr 2026 07:55:15 +0200 (CEST)","from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id A21D483C2B\n for <u-boot@lists.denx.de>; Thu, 16 Apr 2026 07:55:12 +0200 (CEST)","from pps.filterd (m0279873.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63G0OU3d2972348\n for <u-boot@lists.denx.de>; Thu, 16 Apr 2026 05:55:11 GMT","from mail-pl1-f200.google.com (mail-pl1-f200.google.com\n [209.85.214.200])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dj74gbwn3-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <u-boot@lists.denx.de>; Thu, 16 Apr 2026 05:55:10 +0000 (GMT)","by mail-pl1-f200.google.com with SMTP id\n d9443c01a7336-2b2e06219cbso56923445ad.3\n for <u-boot@lists.denx.de>; Wed, 15 Apr 2026 22:55:10 -0700 (PDT)","from hu-gsanthak-blr.qualcomm.com\n (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b478109a4dsm42652295ad.18.2026.04.15.22.55.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Apr 2026 22:55:08 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n content-transfer-encoding:date:from:message-id:mime-version\n :subject:to; s=qcppdkim1; bh=TnKlgmrKf+axqnrTM+lXubi6aU8y0HDVHi4\n unww4wTc=; b=gtAd9NnFor8UnCet3kG/oyIRDYhgeqI5YZoaw9guiOkSDIz8HTv\n KomzW6mwH5llBvwkQdxxLlox0Zl1dQA3RDRpm5sSmJU99sc1n2MDcZyXNvr8qdNj\n sPZBvaSvLivr/sxx4zUUTJ4kEoIY6KZ/A1jsjMFa8MVicaesQYxTJduaIDk7iRL7\n oCNfBv1OgqPJgVRYwpkjuRKOesegS+7oecc70rZmNj2BY50liQS0hz+DTvZNWH96\n +dPLm80Z8eMHiGiab0Q0XxHA7/0skX3vZWQRpnIGq0pYHfKUcTAsA8B/wbjcl9qb\n tDZaCAW325Qj0kR+SK/FB2rzkE3uu/tnjIA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1776318909; x=1776923709; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:from:to:cc:subject:date:message-id:reply-to;\n bh=TnKlgmrKf+axqnrTM+lXubi6aU8y0HDVHi4unww4wTc=;\n b=ITFNcZtYxL/Rnp0DUAptbDoUdL2r3ZCZyoTwljhesCJ2X4hekYN5NsmBJKVoMs7K0+\n kbGucva/QVfDlgTPyvZhkwnuhzSrk50QQjfxeTMkrKXqHubzpovAuRf98yyLv5UW4gqf\n p+BkcYRE61N9TmopzTmUG3v5s/hyhu7FdfnwIqYKCyxu1yd4mENM/rmAOxDRrlFesF3e\n fZZOQ500wC9jwAsAHDlhOt8gGVpVu5tPcuxYUo5xocaR3oiGoSuDLbovHMfWoMk2wanQ\n Cm5MkSfJXso0zkzRgqUAYQ6Qkpf02tqYVAEMyQtXlAWupIJo4PXFz1xpCK45OVDZ8KwG\n N5Kg=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776318909; x=1776923709;\n h=content-transfer-encoding:mime-version:message-id:date:subject:to\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=TnKlgmrKf+axqnrTM+lXubi6aU8y0HDVHi4unww4wTc=;\n b=QtDYlKyAB/h49tB9TJcd2l5v1H7GJGsZzibdhD7a/OxSQUDd2R925FqXYuMGpFF7Gc\n L5QmI1XMNGWpQz/fwfoF0vdJJI4IUGRMsu9ITMQvOAbUL0jesztK2vYwpbbxhgutoCcX\n JIJnqmRKUfgNxYt/1iKR3B/ruOkNpAgLImWRcSKfpw8D7dtUn+drh2b5X8V3LIWb3zF5\n BjjQNrbN4sdV9m6/9tScFy4s/dl6JqnIUT3Y037OcoWDWh4bDqYta31RkPWMgYRZocxz\n 34WADLw+nSkLP2r5YUqIe4RyRjt7kKVXp75kYW+rskHWOAyJbK4YJSzs2wBBdd4qMIx+\n SapQ==","X-Forwarded-Encrypted":"i=1;\n AFNElJ/CUz6V1d4/N00zbQLnprFa2ypDW0U+T6N2tClSxSWkKIIb+4ktZYHZagMSDhzndjCOoGe8cok=@lists.denx.de","X-Gm-Message-State":"AOJu0YzCpw6UtWjusJSrHvuYJmXBouisHZpeqR6L+WoaIttTgAuDE3I2\n 7kA72ko/xOQAGp4bjLUwaFd4yyIdwqF+qbSZX5LWSBQ3FPKn3p3k4m2NUHufYBJ+o++uLwt83aZ\n XvVlYDO/RWqCNYq1fARhBE60/ZXTzBTUXVKQ+yz/NLRD2LwOHC3dV029H","X-Gm-Gg":"AeBDiet+laK+82Rhgxdi0PWMEi8wqL8iVmslXmAaZzOUBd5qn27cl46dKXsNSY54Nu1\n ifdpa+AQnaGRMOYWdY4gUwncAlyVNwSbaTNVFzpUOCdcOa9AMtNvFa5Zk3zzC6EcbEuIM80kINb\n G2GyWyAtZpXW/BOK+w8+M+cZUd+3zKfXtA7W9rsnYenLGxaw7/mD+EIN6LycCNpiQUjkjBn1Ywg\n 2zfTSLlIT4Vp375UbtX3J2K/Dg0r8ayMvxg5+nzHa1fUSNIJeUf79/sfCOjtI+ywJ5tqH6bd6+R\n QRqEs/oQyY7Qut6TmDe0K01OmjUuSM1gXo3EPIiRlyHpjuarINWNvby9OJCHIB7THJGk2duQLSK\n vrTkIX0bs5kvppw3xaYruEOkCOdFLyvCgYTrSXue92/7awK4nB4s+vil2m+BJkQGuufJJrgKnqB\n H7ZESN9SMYfFWb9tUtkAZKt+3kFiYmcV7kBrU2HD8RmdktCaT8OibNmZY/wq7PPhPUT1U=","X-Received":["by 2002:a17:903:3de3:b0:2b0:624f:8edc with SMTP id\n d9443c01a7336-2b2d597d43dmr178466025ad.12.1776318909521;\n Wed, 15 Apr 2026 22:55:09 -0700 (PDT)","by 2002:a17:903:3de3:b0:2b0:624f:8edc with SMTP id\n d9443c01a7336-2b2d597d43dmr178465815ad.12.1776318909040;\n Wed, 15 Apr 2026 22:55:09 -0700 (PDT)"],"From":"Gurumoorthy Santhakumar <gurumoorthy.santhakumar@oss.qualcomm.com>","To":"marex@denx.de, trini@konsulko.com, mkorpershoek@kernel.org,\n macromorgan@hotmail.com, casey.connolly@linaro.org,\n quic_varada@quicinc.com, felipe.balbi@linux.intel.com,\n gurumoorthy.santhakumar@oss.qualcomm.com, u-boot@lists.denx.de","Subject":"[PATCH v2] usb: dwc3: core: fix memory leaks in event buffer cleanup","Date":"Thu, 16 Apr 2026 11:25:01 +0530","Message-Id":"<20260416055501.494002-1-gurumoorthy.santhakumar@oss.qualcomm.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDE2MDA1MyBTYWx0ZWRfX7br702XDZcej\n EEIX33bL+6Y14H8BnIdtosU8ciTdauH8CUxsZ2uKBPzN2u0BQuxj3BonpAV3aruSYb4mLC9Ot/G\n 9BremoM19mw7u93nvG/EIfTLObkoUkPY0JCWhWQr1ssnScawKpumJYBbrnvgDT4c5Ie5eA/rPl7\n KIrOE8UGJpiR7RNfExRuc0SNdV6bedHXqf1aFcF//eQxc7MJwi+k9jswlebs2/cwb21D7RM+3a1\n fzK4ipA0ZUljpARLjC1FrXiipsNk05HuembF9zfzZHAZq1gTsE+bBJTonUNpQScrXHRia2kZa+n\n o9/LD0eesAPAp+yScEuL2xhNvqfmh4lYXLtfATqRu9WbZdRCOvTbW6lOagcYeQleWhV5081rXws\n NVwa8xVoypvZwmry8QIQ8dXpbFEyttJ/Yb5djIIOusG+s/RkoLK+DoJeQ7hRcIxSWEWXHPSNcEz\n COc1K0NHddPx2vcBOcg==","X-Proofpoint-ORIG-GUID":"AIAu_hR7oX_78ojHGig20zRoNqVBQZ8c","X-Authority-Analysis":"v=2.4 cv=ZIfnX37b c=1 sm=1 tr=0 ts=69e079be cx=c_pps\n a=IZJwPbhc+fLeJZngyXXI0A==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17\n a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=VwQbUJbxAAAA:8\n a=EUspDBNiAAAA:8 a=8ukGJnHcqfySqs3Rp24A:9 a=uG9DUKGECoFWVXl0Dc02:22","X-Proofpoint-GUID":"AIAu_hR7oX_78ojHGig20zRoNqVBQZ8c","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-16_01,2026-04-13_04,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n impostorscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0\n phishscore=0 clxscore=1015 malwarescore=0 adultscore=0 priorityscore=1501\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160053","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"In dwc3_free_one_event_buffer(), only the DMA buffer (evt->buf) was\nbeing freed via dma_free_coherent(), but the evt structure itself was\nnever explicitly freed, causing a memory leak.\n\nIn dwc3_free_event_buffers(), the ev_buffs pointer array allocated\nwith memalign() was never freed after iterating and releasing all\nindividual event buffers, causing another memory leak.\n\nFix both leaks by freeing the evt struct in\ndwc3_free_one_event_buffer() and freeing dwc->ev_buffs in\ndwc3_free_event_buffers() after all entries have been released.\n\nSigned-off-by: Gurumoorthy Santhakumar <gurumoorthy.santhakumar@oss.qualcomm.com>\n---\nChanges in V2:\n- Removed redundant NULL check before free\n- Removed NULL assignment to the pointer after free\n- Link to V1:\nhttps://lore.kernel.org/u-boot/20260414055013.2978223-1-gurumoorthy.santhakumar@oss.qualcomm.com/\n---\n---\n drivers/usb/dwc3/core.c | 3 +++\n 1 file changed, 3 insertions(+)","diff":"diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c\nindex 6f22b9232ba..65c4d1a4e6f 100644\n--- a/drivers/usb/dwc3/core.c\n+++ b/drivers/usb/dwc3/core.c\n@@ -206,6 +206,7 @@ static void dwc3_free_one_event_buffer(struct dwc3 *dwc,\n \t\tstruct dwc3_event_buffer *evt)\n {\n \tdma_free_coherent(evt->buf);\n+\tfree(evt);\n }\n \n /**\n@@ -252,6 +253,8 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)\n \t\tif (evt)\n \t\t\tdwc3_free_one_event_buffer(dwc, evt);\n \t}\n+\n+\tfree(dwc->ev_buffs);\n }\n \n /**\n","prefixes":["v2"]}