Skip to content

Commit

Permalink
ethtool: prevent null pointer dereference with NTUPLE set but no set_…
Browse files Browse the repository at this point in the history
…rx_ntuple

This change is meant to prevent a possible null pointer dereference if
NETIF_F_NTUPLE is defined but the set_rx_ntuple function pointer is not.

The main motivation behind this patch is to eventually replace the ntuple
interfaces entirely with the network flow classifier interfaces.  This
allows the device drivers to maintain the ntuple check internally while
using the network flow classifier interface for setting up and displaying
rules.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Apr 11, 2011
1 parent 8d7dfc2 commit 5d9f11c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,9 @@ static noinline_for_stack int ethtool_set_rx_ntuple(struct net_device *dev,
struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
int ret;

if (!ops->set_rx_ntuple)
return -EOPNOTSUPP;

if (!(dev->features & NETIF_F_NTUPLE))
return -EINVAL;

Expand Down

0 comments on commit 5d9f11c

Please sign in to comment.