* [PATCH ethtool] Fix segfault with cable test and ./configure --disable-netlink
@ 2020-07-16 22:05 Andrew Lunn
2020-07-20 0:12 ` Michal Kubecek
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-07-16 22:05 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev, Chris Healy, Andrew Lunn
When the netlink interface code is disabled, a stub version of
netlink_run_handler() is used. This stub version needs to handle the
case when there is no possibility for a command to fall back to the
IOCTL call. The two cable tests commands have no such fallback, and if
we don't handle this, ethtool tries to jump through a NULL pointer
resulting in a segfault.
Reported-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
netlink/extapi.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/netlink/extapi.h b/netlink/extapi.h
index c5bfde9..a35d5f2 100644
--- a/netlink/extapi.h
+++ b/netlink/extapi.h
@@ -46,6 +46,12 @@ void nl_monitor_usage(void);
static inline void netlink_run_handler(struct cmd_context *ctx,
nl_func_t nlfunc, bool no_fallback)
{
+ if (no_fallback) {
+ fprintf(stderr,
+ "Command requires kernel netlink support which is not "
+ "enabled in this ethtool binary\n");
+ exit(1);
+ }
}
static inline int nl_monitor(struct cmd_context *ctx)
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH ethtool] Fix segfault with cable test and ./configure --disable-netlink
2020-07-16 22:05 [PATCH ethtool] Fix segfault with cable test and ./configure --disable-netlink Andrew Lunn
@ 2020-07-20 0:12 ` Michal Kubecek
2020-07-20 0:31 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Michal Kubecek @ 2020-07-20 0:12 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, Chris Healy
[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]
On Fri, Jul 17, 2020 at 12:05:09AM +0200, Andrew Lunn wrote:
> When the netlink interface code is disabled, a stub version of
> netlink_run_handler() is used. This stub version needs to handle the
> case when there is no possibility for a command to fall back to the
> IOCTL call. The two cable tests commands have no such fallback, and if
> we don't handle this, ethtool tries to jump through a NULL pointer
> resulting in a segfault.
>
> Reported-by: Chris Healy <cphealy@gmail.com>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Applied, thank you. I'll need to be more thorough with teseting the
--disable-netlink builds.
Michal
> ---
> netlink/extapi.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/netlink/extapi.h b/netlink/extapi.h
> index c5bfde9..a35d5f2 100644
> --- a/netlink/extapi.h
> +++ b/netlink/extapi.h
> @@ -46,6 +46,12 @@ void nl_monitor_usage(void);
> static inline void netlink_run_handler(struct cmd_context *ctx,
> nl_func_t nlfunc, bool no_fallback)
> {
> + if (no_fallback) {
> + fprintf(stderr,
> + "Command requires kernel netlink support which is not "
> + "enabled in this ethtool binary\n");
> + exit(1);
> + }
> }
>
> static inline int nl_monitor(struct cmd_context *ctx)
> --
> 2.27.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ethtool] Fix segfault with cable test and ./configure --disable-netlink
2020-07-20 0:12 ` Michal Kubecek
@ 2020-07-20 0:31 ` Andrew Lunn
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2020-07-20 0:31 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev, Chris Healy
On Mon, Jul 20, 2020 at 02:12:51AM +0200, Michal Kubecek wrote:
> On Fri, Jul 17, 2020 at 12:05:09AM +0200, Andrew Lunn wrote:
> > When the netlink interface code is disabled, a stub version of
> > netlink_run_handler() is used. This stub version needs to handle the
> > case when there is no possibility for a command to fall back to the
> > IOCTL call. The two cable tests commands have no such fallback, and if
> > we don't handle this, ethtool tries to jump through a NULL pointer
> > resulting in a segfault.
> >
> > Reported-by: Chris Healy <cphealy@gmail.com>
> > Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>
> Applied, thank you. I'll need to be more thorough with teseting the
> --disable-netlink builds.
Hi Michal
Yes. We are all focused on retlink, and missed the backwards
compatibility issues like this.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-20 0:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 22:05 [PATCH ethtool] Fix segfault with cable test and ./configure --disable-netlink Andrew Lunn
2020-07-20 0:12 ` Michal Kubecek
2020-07-20 0:31 ` Andrew Lunn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.