OpenCloudOS-Kernel/drivers/net/ethernet/intel
John Fastabend 9cc00b51a3 ixgbe: ethtool: stats user buffer overrun
If the number of tx/rx queues changes the ethtool ioctl
ETHTOOL_GSTATS may overrun the userspace buffer. This
occurs because the general practice in user space to
query stats is to issue a ETHTOOL_GSSET cmd to learn the
buffer size needed, allocate the buffer, then call
ETHTOOL_GSTIRNGS and ETHTOOL_GSTATS. If the number of
real_num_queues is changed or flow control attributes
are changed after ETHTOOL_GSSET but before the
ETHTOOL_GSTRINGS/ETHTOOL_GSTATS a user space buffer
overrun occurs.

To fix the overrun always return the max buffer size
needed from get_sset_count() then return all strings
and stats from get_strings()/get_ethtool_stats().

This _will_ change the output from the ioctl() call
which could break applications and script parsing in
theory. I believe these changes should not break existing
tools because the only changes will be more {tx|rx}_queues
and the {tx|rx}_pb_* stats will always be returned.
Existing scripts already need to handle changing number
of queues because this occurs today depending on system
and current features. The {tx|rx}_pb_* stats are at the
end of the output and should be handled by scripts today
regardless.

Finally get_ethtool_stats and get_strings are free-form
outputs tools parsing these outputs should be defensive
anyways. In the end these updates are better then
having a tool segfault because of a buffer overrun.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2012-02-09 01:27:47 -08:00
..
e1000 e1000: add dropped DMA receive enable back in for WoL 2012-02-09 01:24:23 -08:00
e1000e net: fix assignment of 0/1 to bool variables. 2011-12-19 22:27:29 -05:00
igb igb: fix vf lookup 2012-02-09 01:24:29 -08:00
igbvf igbvf: change copyright date 2012-02-03 03:07:15 -08:00
ixgb net: fix assignment of 0/1 to bool variables. 2011-12-19 22:27:29 -05:00
ixgbe ixgbe: ethtool: stats user buffer overrun 2012-02-09 01:27:47 -08:00
ixgbevf ixgbevf: Update copyright notices 2012-02-03 03:07:09 -08:00
Kconfig i825xx:xscale:8390:freescale: Fix Kconfig dependancies 2011-11-04 17:41:20 -04:00
Makefile intel: Move the Intel wired LAN drivers 2011-08-10 20:03:27 -07:00
e100.c Sweep away N/A fw_version dustbunnies from the .get_drvinfo routine of a number of drivers 2011-11-22 16:43:32 -05:00