Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6acbe371 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ethtool-set-channels-fix'



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:
0faa9cb5 net sched actions: fix refcnt when GETing of action after bind
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 003ecadd 639e9e94
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -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;

@@ -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);
+0 −10
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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)