]> git.baikalelectronics.ru Git - kernel.git/commit
ethtool: Update ethtool_rxnfc::rule_cnt on return from ETHTOOL_GRXCLSRLALL
authorBen Hutchings <bhutchings@solarflare.com>
Tue, 6 Sep 2011 13:52:47 +0000 (13:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Sep 2011 23:25:10 +0000 (19:25 -0400)
commitefeb0cf722cb67666be0a4a09ff10c59c1e8201b
treeff40ee34b7ac14c920993bb655527338419dea63
parentffa7786bc4d5d1b252753b751e511a4839636427
ethtool: Update ethtool_rxnfc::rule_cnt on return from ETHTOOL_GRXCLSRLALL

A user-space process must use ETHTOOL_GRXCLSRLCNT to find the number
of classification rules, then allocate a buffer of the right size,
then use ETHTOOL_GRXCLSRLALL to fill the buffer.  If some other
process inserts or deletes a rule between those two operations,
the user buffer might turn out to be the wrong size.

If it's too small, the return value will be -EMSGSIZE.  But if it's
too large, there is no indication of this.  Fix this by updating
the rule_cnt field on return.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/gianfar_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/sun/niu.c
include/linux/ethtool.h