From 3a73e49caa75928149ea54f570f8afb5f6f4774d Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 3 Jan 2012 11:59:30 +0000 Subject: [PATCH] gianfar: Reject out-of-range RX NFC locations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently the driver only uses location values to maintain an ordered list of filters. Make it reject location values >= MAX_FILER_IDX passed to the ETHTOOL_SRXCLSRLINS command, consistent with the range it reports for the ETHTOOL_GRXCLSRLALL command. Signed-off-by: Ben Hutchings Acked-by: Sebastian Pöhn Signed-off-by: David S. Miller --- drivers/net/ethernet/freescale/gianfar_ethtool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 5890f4b..5a3b2e5 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c @@ -1692,8 +1692,9 @@ static int gfar_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd) ret = gfar_set_hash_opts(priv, cmd); break; case ETHTOOL_SRXCLSRLINS: - if (cmd->fs.ring_cookie != RX_CLS_FLOW_DISC && - cmd->fs.ring_cookie >= priv->num_rx_queues) { + if ((cmd->fs.ring_cookie != RX_CLS_FLOW_DISC && + cmd->fs.ring_cookie >= priv->num_rx_queues) || + cmd->fs.location >= MAX_FILER_IDX) { ret = -EINVAL; break; } -- 2.7.4