From: Hans de Goede <hdegoede@redhat.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
Jeremy Cline <jeremy@jcline.org>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: btrtl: Prevent potential NULL dereference
Date: Wed, 2 Apr 2025 13:55:03 +0200 [thread overview]
Message-ID: <cc9f5c30-45a6-4130-bdf3-732e5f1c6d2b@redhat.com> (raw)
In-Reply-To: <0174d93d-f3a5-48ed-a755-ed7f6455c1bf@stanley.mountain>
Hi,
On 2-Apr-25 1:01 PM, Dan Carpenter wrote:
> The btrtl_initialize() function checks that rtl_load_file() either
> had an error or it loaded a zero length file. However, if it loaded
> a zero length file then the error code is not set correctly. It
> results in an error pointer vs NULL bug, followed by a NULL pointer
> dereference. This was detected by Smatch:
>
> drivers/bluetooth/btrtl.c:592 btrtl_initialize() warn: passing zero to 'ERR_PTR'
>
> Fixes: 26503ad25de8 ("Bluetooth: btrtl: split the device initialization into smaller parts")
> S
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
igned-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/bluetooth/btrtl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index d3eba0d4a57d..7838c89e529e 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -1215,6 +1215,8 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
> rtl_dev_err(hdev, "mandatory config file %s not found",
> btrtl_dev->ic_info->cfg_name);
> ret = btrtl_dev->cfg_len;
> + if (!ret)
> + ret = -EINVAL;
> goto err_free;
> }
> }
next prev parent reply other threads:[~2025-04-02 11:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 11:01 Dan Carpenter
2025-04-02 11:55 ` Hans de Goede [this message]
2025-04-02 21:10 ` patchwork-bot+bluetooth
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=cc9f5c30-45a6-4130-bdf3-732e5f1c6d2b@redhat.com \
--to=hdegoede@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=jeremy@jcline.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=martin.blumenstingl@googlemail.com \
/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
all inboxes | Powered by JetHome®