Re: [syzbot] WARNING in __dev_change_net_namespace

From: Greg Kroah-Hartman
Date: Thu Nov 11 2021 - 03:56:41 EST


On Thu, Nov 11, 2021 at 08:50:33AM +0100, Johannes Berg wrote:
> On Thu, 2021-11-11 at 06:43 +0000, syzbot wrote:
> >
> > console output: https://syzkaller.appspot.com/x/log.txt?x=15b45fb6b00000
>
> So we see that fault injection is triggering a memory allocation failure
> deep within the device_rename():
>
> int __dev_change_net_namespace(struct net_device *dev, struct net *net,
> const char *pat, int new_ifindex)
> {
> ...
> /* Fixup kobjects */
> err = device_rename(&dev->dev, dev->name);
> WARN_ON(err);
>
>
> So we hit that WARN_ON().
>
> I'm not really sure what to do about that though. Feels like we should
> be able to cope with failures here, but clearly we don't, and it seems
> like it would also be tricky to do after all the work already done at
> this point.
>
> Perhaps device_rename() could grow an API to preallocate all the
> memories, but that would also be fairly involved, I imagine?

That would be a mess to unwind at times. For fault-injection stuff like
this, that can not be hit in "real world operation", if the issue can
not be easily handled, I don't think it is worth worrying about.

We have some things like this in the tty layer at boot time, if a memory
failure happens then, we have bigger overall problems in the system than
trying to recover from minor stuff like this.

thanks,

greg k-h