You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
ipv4: fail early when creating netdev named all or default
We create a proc dir for each network device, this will cause conflicts when the devices have name "all" or "default". Rather than emitting an ugly kernel warning, we could just fail earlier by checking the device name. Reported-by: Stephane Chazelas <stephane.chazelas@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
9d7e3ea73c
commit
20e61da7ff
@@ -216,6 +216,12 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
|
||||
return 0;
|
||||
return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
|
||||
}
|
||||
|
||||
static inline bool sysctl_dev_name_is_allowed(const char *name)
|
||||
{
|
||||
return strcmp(name, "default") != 0 && strcmp(name, "all") != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
static inline int inet_is_local_reserved_port(struct net *net, int port)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user