[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_0GfAFufdAiYE_j@hovoldconsulting.com>
Date: Mon, 14 Apr 2025 14:58:36 +0200
From: Johan Hovold <johan@...nel.org>
To: Chenyuan Yang <chenyuan0y@...il.com>
Cc: vkoul@...nel.org, kishon@...nel.org, lumag@...nel.org,
quic_kriskura@...cinc.com, manivannan.sadhasivam@...aro.org,
konrad.dybcio@....qualcomm.com, quic_varada@...cinc.com,
quic_kbajaj@...cinc.com, johan+linaro@...nel.org,
linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org, Krzysztof Kozlowski <krzk@...nel.org>
Subject: Re: [PATCH v2] phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
On Mon, Apr 14, 2025 at 07:50:50AM -0500, Chenyuan Yang wrote:
> The qmp_usb_iomap() helper function currently returns the raw result of
> devm_ioremap() for non-exclusive mappings. Since devm_ioremap() may return
> a NULL pointer and the caller only checks error pointers with IS_ERR(),
> NULL could bypass the check and lead to an invalid dereference.
>
> Fix the issue by checking if devm_ioremap() returns NULL. When it does,
> qmp_usb_iomap() now returns an error pointer via IOMEM_ERR_PTR(-ENOMEM),
> ensuring safe and consistent error handling.
>
> Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
> Fixes: a5d6b1ac56cb ("phy: qcom-qmp-usb: fix memleak on probe deferral")
> CC: Johan Hovold <johan@...nel.org>
> CC: Krzysztof Kozlowski <krzk@...nel.org>
> ---
Thanks for the update, looks good.
Next time, remember to include a short changelog here after the --- line
(so that it does not get included in the commit message when the patch
is applied).
Reviewed-by: Johan Hovold <johan+linaro@...nel.org>
Johan
Powered by blists - more mailing lists