summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-09-06 13:52:47 +0000
committerDavid S. Miller <davem@davemloft.net>2011-09-16 19:25:10 -0400
commit473e64ee4603671efa1e0785418e56e9ffdfc47b (patch)
treeff40ee34b7ac14c920993bb655527338419dea63 /drivers/net/ethernet/sun
parent815c7db5c809ea3d5735de3131ecdf758b0e14ff (diff)
downloadblackbird-op-linux-473e64ee4603671efa1e0785418e56e9ffdfc47b.tar.gz
blackbird-op-linux-473e64ee4603671efa1e0785418e56e9ffdfc47b.zip
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>
Diffstat (limited to 'drivers/net/ethernet/sun')
-rw-r--r--drivers/net/ethernet/sun/niu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 5e1e1d2748ae..d1338885dc8b 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -7299,6 +7299,8 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
}
niu_unlock_parent(np, flags);
+ nfc->rule_cnt = cnt;
+
return ret;
}
OpenPOWER on IntegriCloud