Commit 5d9f11cf authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller
Browse files

ethtool: prevent null pointer dereference with NTUPLE set but no set_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
Signed-off-by: default avatarAlexander Duyck <>
Signed-off-by: default avatarDavid S. Miller <>
parent 8d7dfc2b
......@@ -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)
if (!(dev->features & NETIF_F_NTUPLE))
return -EINVAL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment