Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Doruk Tan Ozturk <doruk@0sec.ai>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Alexander Kappner <agk@godking.net>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net] net: usb: ipheth: fix carrier_work UAF on disconnect
Date: Thu, 30 Jul 2026 17:55:10 -0700	[thread overview]
Message-ID: <20260730175510.2c180a06@kernel.org> (raw)
In-Reply-To: <20260724134250.34360-1-doruk@0sec.ai>

On Fri, 24 Jul 2026 15:42:50 +0200 Doruk Tan Ozturk wrote:
> ipheth_sndbulk_callback() re-arms the carrier-check work on any non-zero
> URB status:
> 
> 	else
> 		schedule_delayed_work(&dev->carrier_work, 0);
> 
> ipheth_disconnect() drains that work via unregister_netdev() ->
> ipheth_close() -> cancel_delayed_work_sync(), and only then kills the URBs
> with ipheth_kill_urbs(). usb_kill_urb() completes any in-flight TX URB
> synchronously with -ENOENT, so ipheth_sndbulk_callback() runs after the
> drain and re-arms carrier_work. free_netdev() then frees the netdev
> whose private area embeds carrier_work, and the pending
> ipheth_carrier_check_work() dereferences the freed device, a
> use-after-free on unplug while a TX URB is in flight.
> 
> Drain carrier_work again after the URB source is stopped and before the
> netdev is freed.

Doesn't look very clean. Maybe we can check netif_running() before
scheduling? Or disable / enable the work.
-- 
pw-bot: cr

      reply	other threads:[~2026-07-31  0:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 13:42 [PATCH net] net: usb: ipheth: fix carrier_work UAF on disconnect Doruk Tan Ozturk
2026-07-31  0:55 ` Jakub Kicinski [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=20260730175510.2c180a06@kernel.org \
    --to=kuba@kernel.org \
    --cc=agk@godking.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=doruk@0sec.ai \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.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