Skip to content

Commit d339727

Browse files
edumazetdavem330
authored andcommitted
net: graceful exit from netif_alloc_netdev_queues()
User space can crash kernel with ip link add ifb10 numtxqueues 100000 type ifb We must replace a BUG_ON() by proper test and return -EINVAL for crazy values. Fixes: 60877a3 ("net: allow large number of tx queues") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 142b942 commit d339727

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/dev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6409,7 +6409,8 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
64096409
struct netdev_queue *tx;
64106410
size_t sz = count * sizeof(*tx);
64116411

6412-
BUG_ON(count < 1 || count > 0xffff);
6412+
if (count < 1 || count > 0xffff)
6413+
return -EINVAL;
64136414

64146415
tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
64156416
if (!tx) {

0 commit comments

Comments
 (0)