From 473e64ee4603671efa1e0785418e56e9ffdfc47b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 6 Sep 2011 13:52:47 +0000 Subject: 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 Signed-off-by: David S. Miller --- drivers/net/ethernet/freescale/gianfar_ethtool.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ethernet/freescale') diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 42238301c425..f30b96fee840 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -1676,6 +1676,7 @@ static int gfar_get_cls_all(struct gfar_private *priv, } cmd->data = MAX_FILER_IDX; + cmd->rule_cnt = i; return 0; } -- cgit v1.2.3