Skip to content

Commit

Permalink
Merge branch 'ethtool-set-channels-fix'
Browse files Browse the repository at this point in the history
Tariq Toukan says:

====================
ethtool fix

This patchset from Eran contains a fix to ethtool set_channels, where the call
to get_channels with an uninitialized parameter might result in garbage fields.
It also contains two followup changes in our mlx4/mlx5 Eth drivers.

Series generated against net commit:
0faa9cb net sched actions: fix refcnt when GETing of action after bind
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 18, 2017
2 parents 003ecad + 639e9e9 commit 6acbe37
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
7 changes: 1 addition & 6 deletions drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,6 @@ static void mlx4_en_get_channels(struct net_device *dev,
{
struct mlx4_en_priv *priv = netdev_priv(dev);

memset(channel, 0, sizeof(*channel));

channel->max_rx = MAX_RX_RINGS;
channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP;

Expand All @@ -1752,10 +1750,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
int xdp_count;
int err = 0;

if (channel->other_count || channel->combined_count ||
channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP ||
channel->rx_count > MAX_RX_RINGS ||
!channel->tx_count || !channel->rx_count)
if (!channel->tx_count || !channel->rx_count)
return -EINVAL;

tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
Expand Down
10 changes: 0 additions & 10 deletions drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,16 +554,6 @@ static int mlx5e_set_channels(struct net_device *dev,
__func__);
return -EINVAL;
}
if (ch->rx_count || ch->tx_count) {
netdev_info(dev, "%s: separate rx/tx count not supported\n",
__func__);
return -EINVAL;
}
if (count > ncv) {
netdev_info(dev, "%s: count (%d) > max (%d)\n",
__func__, count, ncv);
return -EINVAL;
}

if (priv->params.num_channels == count)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ static noinline_for_stack int ethtool_get_channels(struct net_device *dev,
static noinline_for_stack int ethtool_set_channels(struct net_device *dev,
void __user *useraddr)
{
struct ethtool_channels channels, max;
struct ethtool_channels channels, max = { .cmd = ETHTOOL_GCHANNELS };
u32 max_rx_in_use = 0;

if (!dev->ethtool_ops->set_channels || !dev->ethtool_ops->get_channels)
Expand Down

0 comments on commit 6acbe37

Please sign in to comment.