commit:     fded9d90e36431672be55857d6cc2660f7ea9e34
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  2 21:49:15 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Sep  2 21:50:42 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fded9d90

sys-apps/ethtool: fix crash in do_sset()

Closes: https://bugs.gentoo.org/740114
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../{ethtool-5.8.ebuild => ethtool-5.8-r1.ebuild}    |  5 ++++-
 ...tool-5.8-only-memset-non-NULL-link-settings.patch | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/sys-apps/ethtool/ethtool-5.8.ebuild 
b/sys-apps/ethtool/ethtool-5.8-r1.ebuild
similarity index 82%
rename from sys-apps/ethtool/ethtool-5.8.ebuild
rename to sys-apps/ethtool/ethtool-5.8-r1.ebuild
index 7fcdd66a7b8..527c52f3158 100644
--- a/sys-apps/ethtool/ethtool-5.8.ebuild
+++ b/sys-apps/ethtool/ethtool-5.8-r1.ebuild
@@ -15,7 +15,10 @@ IUSE="+netlink"
 DEPEND="app-arch/xz-utils"
 RDEPEND="netlink? ( net-libs/libmnl )"
 
-PATCHES=( "${FILESDIR}/${PN}-5.8-avoid_bashisms.patch" )
+PATCHES=(
+       "${FILESDIR}/${PN}-5.8-avoid_bashisms.patch"
+       "${FILESDIR}/${P}-only-memset-non-NULL-link-settings.patch"
+)
 
 src_configure() {
        econf $(use_enable netlink)

diff --git 
a/sys-apps/ethtool/files/ethtool-5.8-only-memset-non-NULL-link-settings.patch 
b/sys-apps/ethtool/files/ethtool-5.8-only-memset-non-NULL-link-settings.patch
new file mode 100644
index 00000000000..573ee645615
--- /dev/null
+++ 
b/sys-apps/ethtool/files/ethtool-5.8-only-memset-non-NULL-link-settings.patch
@@ -0,0 +1,20 @@
+https://bugs.gentoo.org/740114
+https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=cf12872ebe7d8fac2088e7d2cd5e2a0a5f03499d
+
+--- a/ethtool.c
++++ b/ethtool.c
+@@ -3048,10 +3048,11 @@ static int do_sset(struct cmd_context *ctx)
+               struct ethtool_link_usettings *link_usettings;
+ 
+               link_usettings = do_ioctl_glinksettings(ctx);
+-              memset(&link_usettings->deprecated, 0,
+-                     sizeof(link_usettings->deprecated));
+               if (link_usettings == NULL)
+                       link_usettings = do_ioctl_gset(ctx);
++              else
++                      memset(&link_usettings->deprecated, 0,
++                             sizeof(link_usettings->deprecated));
+               if (link_usettings == NULL) {
+                       perror("Cannot get current device settings");
+                       err = -1;
+ 

Reply via email to