From: Jakub Kicinski <kuba@kernel.org>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org, Jiayuan Chen <jiayuan.chen@shopee.com>,
syzbot+1ec2f6a450f0b54af8c8@syzkaller.appspotmail.com,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Marco Crivellari <marco.crivellari@suse.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v1] linkwatch: hold dev reference to prevent UAF in __linkwatch_run_queue()
Date: Thu, 29 Jan 2026 19:09:18 -0800 [thread overview]
Message-ID: <20260129190918.4d63d241@kernel.org> (raw)
In-Reply-To: <20260128031012.195016-1-jiayuan.chen@linux.dev>
On Wed, 28 Jan 2026 11:10:07 +0800 Jiayuan Chen wrote:
> Subject: [PATCH net-next v1] linkwatch: hold dev reference to prevent UAF in __linkwatch_run_queue()
please use net rather than net-next for fixes.
> netdev_tracker_free(dev, &dev->linkwatch_dev_tracker);
> spin_unlock_irq(&lweventlist_lock);
> +
> + /*
> + * Hold extra reference to protect netdev_unlock_ops().
> + * linkwatch_do_dev() calls __dev_put() which releases
> + * the linkwatch reference. Without this extra hold,
> + * the device could be freed by netdev_run_todo() before
> + * we call netdev_unlock_ops().
> + */
> + __dev_hold(dev);
> netdev_lock_ops(dev);
> linkwatch_do_dev(dev);
> netdev_unlock_ops(dev);
> + __dev_put(dev);
Please move the dev_put() from inside linkwatch_do_dev() out to its
(3) callers, instead of taking another ref. The dev_put() inside
linkwatch_do_dev() logically pairs with de-listing the device so
it's reasonable for the caller that did the de-listing to do it.
(of course that'll let you move it after the unlock)
--
pw-bot: cr
prev parent reply other threads:[~2026-01-30 3:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 3:10 [PATCH net-next v1] linkwatch: hold dev reference to prevent UAF in __linkwatch_run_queue() Jiayuan Chen
2026-01-30 3:09 ` 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=20260129190918.4d63d241@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=jiayuan.chen@shopee.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=syzbot+1ec2f6a450f0b54af8c8@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.