From: Johan Hovold <johan@kernel.org>
To: Chenyuan Yang <chenyuan0y@gmail.com>
Cc: vkoul@kernel.org, kishon@kernel.org, lumag@kernel.org,
quic_kriskura@quicinc.com, manivannan.sadhasivam@linaro.org,
konrad.dybcio@oss.qualcomm.com, quic_varada@quicinc.com,
quic_kbajaj@quicinc.com, johan+linaro@kernel.org,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
Date: Mon, 14 Apr 2025 08:57:10 +0200 [thread overview]
Message-ID: <Z_yxxoa12N9rNn2z@hovoldconsulting.com> (raw)
In-Reply-To: <20250413212518.2625540-1-chenyuan0y@gmail.com>
On Sun, Apr 13, 2025 at 04:25:18PM -0500, Chenyuan Yang wrote:
> In qmp_usb_iomap(), one branch returns the result of devm_ioremap(), which
> can be NULL. Since IS_ERR() does not catch a NULL pointer,
> add an explicit NULL check in qmp_usb_parse_dt_legacy() to prevent
> potential dereference issues.
Good catch, but please move the handling of this into the
qmp_usb_iomap() helper so that it returns an error pointer also if
devm_ioremap() fails.
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> Fixes: 2a55ec4f0a04 ("phy: qcom-qmp-usb: merge driver data")
This is not the commit that introduced the issue; this should be:
Fixes: a5d6b1ac56cb ("phy: qcom-qmp-usb: fix memleak on probe deferral")
> qmp->pcs = qmp_usb_iomap(dev, np, 2, exclusive);
> + if (!qmp->pcs)
> + return -ENOMEM;
> if (IS_ERR(qmp->pcs))
> return PTR_ERR(qmp->pcs);
Johan
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2025-04-14 6:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-13 21:25 [PATCH] phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug Chenyuan Yang
2025-04-14 6:57 ` Johan Hovold [this message]
2025-04-14 7:30 ` Krzysztof Kozlowski
2025-04-14 7:40 ` Johan Hovold
2025-04-14 8:08 ` Krzysztof Kozlowski
2025-04-14 8:13 ` Johan Hovold
2025-04-14 12:52 ` Chenyuan Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_yxxoa12N9rNn2z@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=chenyuan0y@gmail.com \
--cc=johan+linaro@kernel.org \
--cc=kishon@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=lumag@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=quic_kbajaj@quicinc.com \
--cc=quic_kriskura@quicinc.com \
--cc=quic_varada@quicinc.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox