lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 27 Mar 2019 10:38:43 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     Michal Kubecek <mkubecek@...e.cz>
Cc:     David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        John Linville <linville@...driver.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v5 08/22] ethtool: support for netlink
 notifications

Tue, Mar 26, 2019 at 07:17:20PM CET, mkubecek@...e.cz wrote:
>On Tue, Mar 26, 2019 at 05:34:00PM +0100, Jiri Pirko wrote:
>> Mon, Mar 25, 2019 at 06:08:18PM CET, mkubecek@...e.cz wrote:
>> >+void ethtool_notify(struct net_device *dev, struct netlink_ext_ack *extack,
>> >+		    unsigned int cmd, u32 req_mask, const void *data)
>> >+{
>> >+	if (unlikely(!ethnl_ok))
>> 
>> Why do you need this?
>
>If genetlink family registration fails, ethtool_notify() can be still
>called from other code (e.g. the ethtool ioctl interface). In such case,
>better bail out right away than fail somewhere later (probably after
>preparing the message which can't be sent anyway).

Again, haven't seen this in any other gen netlink implementation. Why do
they not need it?


>
>> >+		return;
>> >+	ASSERT_RTNL();
>> >+
>> >+	if (likely(cmd < ARRAY_SIZE(ethnl_notify_handlers) &&
>> >+		   ethnl_notify_handlers[cmd]))
>> >+		ethnl_notify_handlers[cmd](dev, extack, cmd, req_mask, data);
>> >+	else
>> >+		WARN_ONCE(1, "notification %u not implemented (dev=%s, req_mask=0x%x)\n",
>> >+			  cmd, netdev_name(dev), req_mask);
>> >+}
>> >+EXPORT_SYMBOL(ethtool_notify);
>> 
>> Please be consistent with prefixes. Rest of the code (most of it) has
>> prefix "ethnl".
>
>The reason why I used ethtool_ prefix here was that this function is an
>entry point which can be called from anywhere and other code doesn't
>care if we are using netlink or something else. But as any caller would
>need to include <linux/ethtool_netlink.h> anyway to get the constants
>for cmd and req_mask, there is no point hiding the fact. I'll rename it
>to ethnl_notify().

Okay.


>
>> >diff --git a/net/ethtool/netlink.h b/net/ethtool/netlink.h
>> >index b8a6cd3dc3e3..5f2299548915 100644
>> >--- a/net/ethtool/netlink.h
>> >+++ b/net/ethtool/netlink.h
>> >@@ -11,6 +11,8 @@
>> > #define ETHNL_SET_ERRMSG(info, msg) \
>> > 	do { if (info) GENL_SET_ERR_MSG(info, msg); } while (0)
>> > 
>> >+extern u32 ethnl_bcast_seq;
>> 
>> Why do you need to have this in header? Second, it is not used by
>> anything. Please don't introduce variables that are not used. Introduce
>> them only in patch where you use it.
>
>It's the same as with ethtool_genl_family. I'll make it static as well
>until it's used in some other file.

Not only static. You should remove it as you are not using it in this
patch at all.


>
>Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ