Re: [syzbot] WARNING in __dev_change_net_namespace

From: Johannes Berg
Date: Thu Nov 11 2021 - 02:50:52 EST


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?

johannes