gianfar: Reject out-of-range RX NFC locations
authorBen Hutchings <bhutchings@solarflare.com>
Tue, 3 Jan 2012 11:59:30 +0000 (11:59 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Jan 2012 19:09:10 +0000 (14:09 -0500)
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 <bhutchings@solarflare.com>
Acked-by: Sebastian Pöhn <sebastian.poehn@googlemail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/gianfar_ethtool.c

index 5890f4b0c0da2df08372127b01897338469cf05c..5a3b2e5b28802d67028212996974bf04d7fd8cca 100644 (file)
@@ -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;
                }