In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;
In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;
In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;
In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;
In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;
In the Linux kernel, the following vulnerability has been resolved:net: napi: Prevent overflow of napi_defer_hard_irqsIn commit 6f8b12d661d0 ( net: napi: add hard irqs deferral feature )napi_defer_irqs was added to net_device and napi_defer_irqs_count wasadded to napi_struct, both as type int.This value never goes below zero, so there is not reason for it to be asigned int. Change the type for both from int to u32, and add anoverflow check to sysfs to limit the value to S32_MAX.The limit of S32_MAX was chosen because the practical limit before thispatch was S32_MAX (anything larger was an overflow) and thus there areno behavioral changes introduced. If the extra bit is needed in thefuture, the limit can be raised.Before this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs $ cat /sys/class/net/eth4/napi_defer_hard_irqs-2147483647After this patch:$ sudo bash -c echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs bash: line 0: echo: write error: Numerical result out of rangeSimilarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned:include/linux/netdevice.h: unsigned int tx_queue_len;And has an overflow check:dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE;