[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD=FV=X+mjEYu4WU-0nbHMtW-HAzm6EUeBnZj46g27O3iobKBQ@mail.gmail.com>
Date: Wed, 19 Nov 2025 09:30:45 -0800
From: Doug Anderson <dianders@...omium.org>
To: Marcel Holtmann <marcel@...tmann.org>, Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: Thorsten Leemhuis <regressions@...mhuis.info>, incogcyberpunk@...ton.me,
johan.hedberg@...il.com, regressions@...ts.linux.dev, sean.wang@...iatek.com,
linux-arm-kernel@...ts.infradead.org, linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] Bluetooth: btusb: mediatek: Avoid btusb_mtk_claim_iso_intf()
NULL deref
Hi,
On Wed, Nov 19, 2025 at 8:54 AM Douglas Anderson <dianders@...omium.org> wrote:
>
> In btusb_mtk_setup(), we set `btmtk_data->isopkt_intf` to:
> usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM)
>
> That function can return NULL in some cases. Even when it returns
> NULL, though, we still go on to call btusb_mtk_claim_iso_intf().
>
> As of commit e9087e828827 ("Bluetooth: btusb: mediatek: Add locks for
> usb_driver_claim_interface()"), calling btusb_mtk_claim_iso_intf()
> when `btmtk_data->isopkt_intf` is NULL will cause a crash because
> we'll end up passing a bad pointer to device_lock(). Prior to that
> commit we'd pass the NULL pointer directly to
> usb_driver_claim_interface() which would detect it and return an
> error, which was handled.
>
> Resolve the crash in btusb_mtk_claim_iso_intf() by adding a NULL check
> at the start of the function. This makes the code handle a NULL
> `btmtk_data->isopkt_intf` the same way it did before the problematic
> commit (just with a slight change to the error message printed).
>
> Reported-by: IncogCyberpunk <incogcyberpunk@...ton.me>
> Closes: http://lore.kernel.org/r/a380d061-479e-4713-bddd-1d6571ca7e86@leemhuis.info
> Fixes: e9087e828827 ("Bluetooth: btusb: mediatek: Add locks for usb_driver_claim_interface()")
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
> I have no way to test this commit myself other than to compile it. It
> looks fairly straightforward, though, so I'm hopeful it will fix the
> problem.
>
> drivers/bluetooth/btusb.c | 5 +++++
> 1 file changed, 5 insertions(+)
Ugh, the bluetooth bot properly told me that my patch doesn't apply to
bt-next. I'll send a v2 right away. Sorry for the noise.
-Doug
Powered by blists - more mailing lists