lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 18 Nov 2010 16:25:54 +0100 From: Daniel Turull <daniel.turull@...il.com> To: netdev@...r.kernel.org Cc: "Voravit T." <voravit@....se>, Robert Olsson <robert@...julf.net> Subject: [PATH] dev: reusing unregistered ifindex values in net_device When a new index is going to be assigned in register_netdevice, the dev_new_index starts to search possible values from the last index given to a device although there might be some free ifindex that has been previously unregistered. This behaviour may create gap(s) in the ifindex list. This patch checks for unused values from 1 and gives to the new device the first available value. This limits the maximum ifindex to a smaller value. The ifindex will still be unique since the old value is no longer in use. Reported-by: Voravit Tanyingyong <voravit@....se> Signed-off-by: Daniel Turull <daniel.turull@...il.com> --- diff --git a/net/core/dev.c b/net/core/dev.c index 381b8e2..a7babab 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4871,7 +4871,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) */ static int dev_new_index(struct net *net) { - static int ifindex; + int ifindex; for (;;) { if (++ifindex <= 0) ifindex = 1; -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists