Netdev List
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jie Wang <jie.wang@intel.com>
Cc: Chas Williams <3chas3@gmail.com>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-atm-general@lists.sourceforge.net,
	accessrunner-general@lists.sourceforge.net,
	syzbot+9b195c4f412ea5c4e56a@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] usb: atm: cxacru: fix NULL deref of atm_dev on sysfs writes
Date: Thu, 10 Sep 2026 14:47:42 +0200	[thread overview]
Message-ID: <2026091012-nastiness-coveted-74e3@gregkh> (raw)
In-Reply-To: <20260908150203.2119844-1-jie.wang@intel.com>

On Tue, Sep 08, 2026 at 03:02:03PM +0000, Jie Wang wrote:
> The adsl_state and adsl_config sysfs attributes are created via
> dev_groups, so the driver core exposes them as soon as ->probe()
> returns. At that point instance->atm_dev can still be NULL:
> usbatm_heavy_init() only waits for the heavy-init kthread to start, not
> to finish, and instance->atm_dev is assigned later, in usbatm_atm_init().
> 
> A write to either attribute in that window passes the existing
> "instance == NULL" check and reaches atm_err()/atm_info() on the error
> path (and, for adsl_config, on the success path). Both expand to
> instance->atm_dev->number and dereference the NULL atm_dev.
> 
> Fix this by logging with usb_err()/usb_info() instead. They reference the
> USB interface device, which stays valid for the whole write, and
> usbatm_atm_init() already logs this way before atm_dev exists.
> 
> adsl_state_store() also calls cxacru_poll_status() directly, which
> dereferences atm_dev via atm_dev_signal_change() and atm_dev->link_rate.
> Return early from the poll when atm_dev is not yet set.
> 
> Fixes: e605c30977bb ("USB: atm: cxacru: convert to use dev_groups")
> Reported-by: syzbot+9b195c4f412ea5c4e56a@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=9b195c4f412ea5c4e56a
> Tested-by: syzbot+9b195c4f412ea5c4e56a@syzkaller.appspotmail.com
> Signed-off-by: Jie Wang <jie.wang@intel.com>

Did you forget an assisted-by: tag?


> ---
> Changes since v1 [1]:
>  - v1 gated on ->atm_dev at handler entry, but that check is an
>    unsynchronized TOCTOU; remove the ->atm_dev dereference from these
>    paths instead.

Sashiko still has some objections:
	https://sashiko.dev/#/patchset/20260908150203.2119844-1-jie.wang@intel.com


      reply	other threads:[~2026-09-10 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 14:40 [PATCH] usb: atm: cxacru: fix NULL pointer dereference on uninitialized atm_dev syzbot
2026-09-02  8:42 ` netdev-bot+sashiko
2026-09-08 15:02 ` [PATCH v2] usb: atm: cxacru: fix NULL deref of atm_dev on sysfs writes Jie Wang
2026-09-10 12:47   ` Greg Kroah-Hartman [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=2026091012-nastiness-coveted-74e3@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=3chas3@gmail.com \
    --cc=accessrunner-general@lists.sourceforge.net \
    --cc=jie.wang@intel.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+9b195c4f412ea5c4e56a@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