From nobody Mon Feb 9 03:31:25 2026 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (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 870A12F6160 for ; Mon, 26 Jan 2026 08:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769415108; cv=none; b=HIovHWdDsUhoanH+WBP8Hh+J+8PHcHIVd479oatz1vo7KCwf6fWWtJCiF8LSV9lBygUfV0qYBgJKrGJOZT1aUcby4pm8vhuXTY8/c4AeQ2qV3JOQ92rcp3lBGWDLlsp0FRAfPsaOeCBDHe+3rz910mPKthRNDbVQkIWufwGqy8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769415108; c=relaxed/simple; bh=ifV7LwpCjUc/PFXzGxlOPTERcpkWlIu9uCxx7w7hzSc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cnARoYTh047tQz8qx+Vh3sjzLXaFNW9Ek9YsMUs+wuUUASapjIPpCoUeeDn0MZ6G/CF0IS3TkZJgoeW24KJgwRpBSpfmgCcIzhxNIu0eaVodQXnZph6ccSusaBdunhSkqi3O4mVZzucKcA6tEpGC9TCPrz53yk3xSw0sp4BBaKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=RcfzYdw+; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="RcfzYdw+" Received: from LAPTOP-N070L597.localdomain (unknown [81.31.232.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 31f72b0f2; Mon, 26 Jan 2026 16:11:31 +0800 (GMT+08:00) From: Zilin Guan To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, aniketmaurya@google.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, Zilin Guan Subject: [PATCH] i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers() Date: Mon, 26 Jan 2026 08:11:21 +0000 Message-Id: <20260126081121.644099-1-zilin@seu.edu.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Tid: 0a9bf95ba17a03a1kunm11aa4cf6131075 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZQ00ZVhlMHUIfGB5JThlOTlYeHw5VEwETFhoSFy QUDg9ZV1kYEgtZQVlDSlVISlVJSElVQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSUJDQ0xVSktLVUtZBg ++ DKIM-Signature: a=rsa-sha256; b=RcfzYdw+5oaxnCcgnl63gEYZ+kk4cohfcbjtUhTQwDbHrpRBnXzAjykR5y/xIZwhDXOdTuAdljo6h3s/8dRkESWFQOr+M8bgK1e93hhgBvvUBAn/6wPBOsbORcQyGMYIhdxdn+3ZeS8qgUUuCe9qcTNWQUcGLXfXcKbOhQeUMis=; c=relaxed/relaxed; s=default; d=seu.edu.cn; v=1; bh=7LRJaJGzkQ6sYAkEFSwZ70mpAwxcvUV07CkXsrSmy7k=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" The dw_i3c_master_i2c_xfers() function allocates memory for the xfer structure using dw_i3c_master_alloc_xfer(). If pm_runtime_resume_and_get() fails, the function returns without freeing the allocated xfer, resulting in a memory leak. Add a dw_i3c_master_free_xfer() call to the error path to ensure the allocated memory is properly freed. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: 62fe9d06f570 ("i3c: dw: Add power management support") Signed-off-by: Zilin Guan Reviewed-by: Frank Li --- drivers/i3c/master/dw-i3c-master.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c= -master.c index 889e2ed5bc83..3e6f66dff2ec 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -1099,6 +1099,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_des= c *dev, dev_err(master->dev, "<%s> cannot resume i3c bus master, err: %d\n", __func__, ret); + dw_i3c_master_free_xfer(xfer); return ret; } =20 --=20 2.34.1