Subject: Re: [PATCH net v2] net: vlan: fix a UAF in vlan_dev_real_dev()

From: Petr Machata <[email-masked]>
Date: Fri, 19 Nov 2021 11:07:01 +0100

Ziyang Xuan (William) <[email-masked]> writes:

> I need some time to test my some ideas. And anyone has good ideas, please
> do not be stingy.

Jakub Kicinski <[email-masked]> writes:

> I think we should move the dev_hold() to ndo_init(), otherwise it's
> hard to reason if destructor was invoked or not if
> register_netdevice() errors out.

That makes sense to me. We always put real_dev in the destructor, so we
should always hold it in the constructor...