From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796005731; b=mZ6sOqIX3Q3VtlK49FExG/sY41smdLz9wjk2XEGPJfdJYfR71ZtHP59l2UC6zk92qpN8 kedkopFRyhNj0PnldJMjrp/M/6TjM2VXRUuGXj8GGuz9079PnBpXOeb2AhXEMa/iyIueu IQVT5PALCAupWp/MSMo4z8Gk6XV7uU4x4k91ID5MufSnJ6NUhfM09GrnKMwmsaDlu4Rew C/jYjsRcmA9IhgCC0P8Iv4LbUfWzQAXmnuImCaxln7nW2kr39L93d39ytN7sSr64XSKwi HI2We8lESd5DU/X7fSNYwe0LYDuiVaagYC082PokX3VJUdvTUy+pyT+oTmENvFJrS6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796005731; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=7674Kj+dFqMnrl3H5x3E8VHZGqhiY2ItgKnszVh74KE=; b=P4PgBta9eAQryrL50wdsxVMUmdsPa7hw4rdIXFdatucImkaEK7YcBy2TBuFSuEkTDeIp 1vcT6PCdulEb7ehXlA1JiDBJ3DsE+LZPAqlRVmRWco0ovcIThQyfe2vlUa7xURUy7pL/M 5iclMN+05c2UT3JklzDqiWWILJEitN/4cHXLAmwaBAY+8lRtALsNsdaZVf2TutON5kxZ7 N6uJxluy9VP8BL7mEs2TTQz5D/Xu8UeGXFfc0jAnm9dIOUS/iRknFUDXAFzYI176aCg68 iKD+OEwGe6Gv48Z1Z++eY3rSt0QS77+6h0j9fqO7khtk12LqgrL7L5FSDQIshZYhx7w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bXBJZldT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC28B606A327 for ; Mon, 30 Nov 2026 02:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bXBJZldT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3096A1F00897; Mon, 30 Nov 2026 02:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796005731; bh=7674Kj+dFqMnrl3H5x3E8VHZGqhiY2ItgKnszVh74KE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=bXBJZldTSfD+ikD6GsoTNIhvszi+gU+WEqEFwab3IuwMKBMRC/GODYil63s43XZco Dqu8D0Hku5tb1A9lBMy6MgpX1jfd7BO1vA8C4WMYb9NELNW/qyB+FjutVDQgOxBE95 pvIG2bnFp/Vwvrwole+3OseaMp1kllA4yJQ/q+jupUmymKpSEDQRg1TA4+p2zdW5of ukgtv14JUaCb7BfN/EYiS7yzOvcI52NMK/5TlDq7GRXf6HzBz/JNZ/X5OAsUIXUSu7 VxdIqWOq1yCkLjCZAbNJCnVxXVwTBLpmxFYDa9HKsXVfdrxE7Zm9njOYERNt3NgQ8W yfmWu+EH56qVA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] media: nxp: imx8-isi: Fix small memory leak at unbind time Reply-To: sashiko-reviews@lists.linux.dev To: "Laurent Pinchart" Cc: imx@lists.linux.dev, Frank.Li@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261130022322.22508-1-laurent.pinchart@ideasonboard.com> References: <20261130022322.22508-1-laurent.pinchart@ideasonboard.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 02:28:50 +0000 X-Mailing-List: imx@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] media: nxp: imx8-isi: missing pipe unregistration in mxc_isi_v4l2_init() [1] -- commit a31b14b46ef772648d300c8e857600dbf5ef7ce4 Author: Laurent Pinchart media: nxp: imx8-isi: Fix small memory leak at unbind time This commit switches the allocation of isi->pipes in mxc_isi_probe() from kzalloc_objs() to devm_kzalloc_objs() so the array is freed on driver unbind. > diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/driver= s/media/platform/nxp/imx8-isi/imx8-isi-core.c > index 0ae5f35e017c6..9373a52562242 100644 > --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c > +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c > @@ -488,7 +488,8 @@ static int mxc_isi_probe(struct platform_device *pdev) > =20 > isi->pdata =3D of_device_get_match_data(dev); > =20 > - isi->pipes =3D kzalloc_objs(isi->pipes[0], isi->pdata->num_channels); > + isi->pipes =3D devm_kzalloc_objs(dev, isi->pipes[0], > + isi->pdata->num_channels); > if (!isi->pipes) > return -ENOMEM; [Severity: High] This problem wasn't introduced by this patch, but can a failure in mxc_isi_v4l2_init() leak registered video devices and leave them referencing devm-freed isi->pipes memory [1]? drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c:mxc_isi_v4l2_init() { ... for (i =3D 0; i < isi->pdata->num_channels; ++i) { struct mxc_isi_pipe *pipe =3D &isi->pipes[i]; ret =3D mxc_isi_pipe_register(pipe); if (ret < 0) { dev_err(isi->dev, "Failed to register pipe%u: %d\n", i, ret); goto err_v4l2; } ... err_m2m: mxc_isi_m2m_unregister(isi); v4l2_async_nf_cleanup(&isi->notifier); err_v4l2: v4l2_device_unregister(v4l2_dev); err_media: media_device_cleanup(media_dev); return ret; } mxc_isi_pipe_register() calls mxc_isi_video_register(), which registers a capture video_device node and initializes V4L2 control handlers and media entity pads. If a later step in mxc_isi_v4l2_init() fails, err_v4l2 only calls v4l2_device_unregister(), which unregisters subdevs but does not call mxc_isi_pipe_unregister() on the already-registered pipes. With isi->pipes now managed by devm, probe failure frees the pipes array while those /dev/videoN nodes remain registered, leading to a use-after-free if userspace accesses them. [1] https://sashiko.dev/#/bug/linux-aae9d84d-1755-4279-8a12-ff366e28c228 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130022322.2250= 8-1-laurent.pinchart@ideasonboard.com?part=3D1