mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joshua Crofts <joshua.crofts1@gmail.com>
To: David Heidelberg <david@ixit.cz>
Cc: oe-linux-nfc@lists.linux.dev, linux-kernel@vger.kernel.org,
	syzbot+59d5e6a8ed04e6a000c8@syzkaller.appspotmail.com
Subject: Re: [PATCH] nfc: nfcmrvl: fix null pointer dereference in nfcmrvl_bulk_complete
Date: Tue, 8 Sep 2026 13:30:33 +0200	[thread overview]
Message-ID: <20260908133033.000037c5@gmail.com> (raw)
In-Reply-To: <20260831104110.1307-1-joshua.crofts1@gmail.com>

On Mon, 31 Aug 2026 10:41:10 +0000
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> A race condition in the current implementation can cause a null pointer
> dereference. When nfcmrvl_nci_register_dev() calls nci_register_device(),
> the NCI device is immediately exposed to userspace. If userspace brings
> up the device before probe() finishes assigning drv_data->priv,
> submitted bulk URBs can complete while priv is still NULL.
> 
> Additionally, nfcmrvl_bulk_complete() incorrectly checked
> NFCMRVL_NCI_RUNNING on drv_data->flags instead of drv_data->priv->flags.
> 
> Fix this by adding a NULL check and testing NFCMRVL_NCI_RUNNING on
> drv_data->priv->flags before processing the completed URB.
> 
> Fixes: f26e30cc6b50 ("NFC: nfcmrvl: Initial commit for Marvell NFC driver")
> Reported-by: syzbot+59d5e6a8ed04e6a000c8@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=59d5e6a8ed04e6a000c8
> Tested-by: syzbot+59d5e6a8ed04e6a000c8@syzkaller.appspotmail.com
> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
> ---
>  drivers/nfc/nfcmrvl/usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
> index c7f2afe00b93..c22d783718fe 100644
> --- a/drivers/nfc/nfcmrvl/usb.c
> +++ b/drivers/nfc/nfcmrvl/usb.c
> @@ -61,7 +61,7 @@ static void nfcmrvl_bulk_complete(struct urb *urb)
>  	dev_dbg(&drv_data->udev->dev, "urb %p status %d count %d\n",
>  		urb, urb->status, urb->actual_length);
>  
> -	if (!test_bit(NFCMRVL_NCI_RUNNING, &drv_data->flags))
> +	if (!drv_data->priv || !test_bit(NFCMRVL_NCI_RUNNING, &drv_data->priv->flags))
>  		return;
>  
>  	if (!urb->status) {

Hi David,

gentle ping on this patch.

-- 
Kind regards,
Joshua Crofts

      reply	other threads:[~2026-09-08 11:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 10:41 Joshua Crofts
2026-09-08 11:30 ` Joshua Crofts [this message]

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=20260908133033.000037c5@gmail.com \
    --to=joshua.crofts1@gmail.com \
    --cc=david@ixit.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-linux-nfc@lists.linux.dev \
    --cc=syzbot+59d5e6a8ed04e6a000c8@syzkaller.appspotmail.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®