Skip to content

Commit 019ec00

Browse files
Mahesh Bandewardavem330
authored andcommitted
ipvlan: fix dev_id creation corner case.
In the last patch da36e13 ("ipvlan: improvise dev_id generation logic in IPvlan") I missed some part of Dave's suggestion and because of that the dev_id creation could fail in a corner case scenario. This would happen when more or less 64k devices have been already created and several have been deleted. If the devices that are still sticking around are the last n bits from the bitmap. So in this scenario even if lower bits are available, the dev_id search is so narrow that it always fails. Fixes: da36e13 ("ipvlan: improvise dev_id generation logic in IPvlan") CC: David Miller <[email protected]> CC: Eric Dumazet <[email protected]> Signed-off-by: Mahesh Bandewar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c634700 commit 019ec00

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ static int ipvlan_link_new(struct net *src_net, struct net_device *dev,
549549
*/
550550
err = ida_simple_get(&port->ida, port->dev_id_start, 0xFFFE,
551551
GFP_KERNEL);
552+
if (err < 0)
553+
err = ida_simple_get(&port->ida, 0x1, port->dev_id_start,
554+
GFP_KERNEL);
552555
if (err < 0)
553556
goto destroy_ipvlan_port;
554557
dev->dev_id = err;

0 commit comments

Comments
 (0)