From: Eran Ben Elisha Date: Tue, 17 Jan 2017 17:19:17 +0000 (+0200) Subject: net: ethtool: Initialize buffer when querying device channel settings X-Git-Tag: archive/raspbian/4.9.30-2+deb9u2+rpi1~4^2~174 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9513a2503f17b1f10adcff85e04f0eb61a5cb006;p=linux-4.9.git net: ethtool: Initialize buffer when querying device channel settings [ Upstream commit 31a86d137219373c3222ca5f4f912e9a4d8065bb ] Ethtool channels respond struct was uninitialized when querying device channel boundaries settings. As a result, unreported fields by the driver hold garbage. This may cause sending unsupported params to driver. Fixes: 8bf368620486 ('ethtool: ensure channel counts are within bounds ...') Signed-off-by: Eran Ben Elisha Signed-off-by: Tariq Toukan CC: John W. Linville Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 072c1f4998c9..e9989b835a66 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -1704,7 +1704,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)