[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210318074342.GQ4652@nanopsycho.orion>
Date: Thu, 18 Mar 2021 08:43:42 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jiri Bohac <jbohac@...e.cz>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH] net: check all name nodes in __dev_alloc_name
Thu, Mar 18, 2021 at 04:42:53AM CET, jbohac@...e.cz wrote:
>__dev_alloc_name(), when supplied with a name containing '%d',
>will search for the first available device number to generate a
>unique device name.
>
>Since commit ff92741270bf8b6e78aa885f166b68c7a67ab13a ("net:
>introduce name_node struct to be used in hashlist") network
>devices may have alternate names. __dev_alloc_name() does take
>these alternate names into account, possibly generating a name
>that is already taken and failing with -ENFILE as a result.
>
>This demonstrates the bug:
>
> # rmmod dummy 2>/dev/null
> # ip link property add dev lo altname dummy0
> # modprobe dummy numdummies=1
> modprobe: ERROR: could not insert 'dummy': Too many open files in system
>
>Instead of creating a device named dummy1, modprobe fails.
>
>Fix this by checking all the names in the d->name_node list, not just d->name.
>
>Signed-off-by: Jiri Bohac <jbohac@...e.cz>
>Fixes: ff92741270bf ("net: introduce name_node struct to be used in hashlist")
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Thanks!
Powered by blists - more mailing lists