aboutsummaryrefslogtreecommitdiff
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-02-01 09:32:25 +0000
committerBen Hutchings <ben@decadent.org.uk>2012-05-31 00:44:03 +0100
commit077ae2b73b4c110e9d458b071a61c9f2b33ee58e (patch)
treec9ee85318270d34886aad7993b39d972dc77ecf2 /net/core/ethtool.c
parentd655fe1e7e79ee5012d83bf66a9e524aa55ec7de (diff)
ethtool: Null-terminate filename passed to ethtool_ops::flash_device
commit 786f528119722f564a22ad953411374e06116333 upstream. The parameters for ETHTOOL_FLASHDEV include a filename, which ought to be null-terminated. Currently the only driver that implements ethtool_ops::flash_device attempts to add a null terminator if necessary, but does it wrongly. Do it in the ethtool core instead. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f4448170712..2b587ec0714 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1549,6 +1549,8 @@ static noinline_for_stack int ethtool_flash_device(struct net_device *dev,
if (!dev->ethtool_ops->flash_device)
return -EOPNOTSUPP;
+ efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0;
+
return dev->ethtool_ops->flash_device(dev, &efl);
}