[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260129190918.4d63d241@kernel.org>
Date: Thu, 29 Jan 2026 19:09:18 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Jiayuan Chen <jiayuan.chen@...ux.dev>
Cc: netdev@...r.kernel.org, Jiayuan Chen <jiayuan.chen@...pee.com>,
syzbot+1ec2f6a450f0b54af8c8@...kaller.appspotmail.com, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Stanislav Fomichev
<sdf@...ichev.me>, Marco Crivellari <marco.crivellari@...e.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v1] linkwatch: hold dev reference to prevent
UAF in __linkwatch_run_queue()
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
Powered by blists - more mailing lists