mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-22 18:44:44 +08:00
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:
0faa9cb5b3
net sched actions: fix refcnt when GETing of action after bind
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6acbe37160
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user