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]
Message-ID: <b8221fe9-a167-4bcc-81bf-fb793712b48e@gmail.com>
Date: Tue, 15 Jul 2025 16:24:22 +0200
From: Andrei Lalaev <andrey.lalaev@...il.com>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: mailhol.vincent@...adoo.fr, linux-kernel@...r.kernel.org,
 linux-can@...r.kernel.org
Subject: Re: [RFC PATCH] can: gs_usb: fix kernel oops during restart

On 15.07.2025 11:37, Marc Kleine-Budde wrote:
> On 14.07.2025 19:55:02, Andrei Lalaev wrote:
>> When CAN adapter in BUS_OFF state and "can_restart" is called,
>> it causes the following kernel oops:
> 
> Doh!
> 
> I wonder why no one stumbled over this before. That's a systematic
> problem for all CAN drivers that don't implement this callback.

Hi Mark,

I was also surprised because this callback isn't marked as mandatory
and that there are no additional checks.

> 
> What about this fix?
> 
> diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c
> index 13826e8a707b..94603c9eb4aa 100644
> --- a/drivers/net/can/dev/netlink.c
> +++ b/drivers/net/can/dev/netlink.c
> @@ -285,6 +285,12 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
>          }
>  
>          if (data[IFLA_CAN_RESTART_MS]) {
> +                if (!priv->do_set_mode) {
> +                        NL_SET_ERR_MSG(extack,
> +                                       "device doesn't support restart from Bus Off");
> +                        return -EOPNOTSUPP;
> +                }
> +
>                  /* Do not allow changing restart delay while running */
>                  if (dev->flags & IFF_UP)
>                          return -EBUSY;
> @@ -292,6 +298,12 @@ static int can_changelink(struct net_device *dev, struct nlattr *tb[],
>          }
>  
>          if (data[IFLA_CAN_RESTART]) {
> +                if (!priv->do_set_mode) {
> +                        NL_SET_ERR_MSG(extack,
> +                                       "device doesn't support restart from Bus Off");
> +                        return -EOPNOTSUPP;
> +                }
> +
>                  /* Do not allow a restart while not running */
>                  if (!(dev->flags & IFF_UP))
>                          return -EINVAL;
> 
> regards,
> Marc
> 

Thanks for the patch. As expected, it fixes the kernel OOPS,
but the interface never leaves the BUS_OFF state.

-- 
Best regards,
Andrei Lalaev

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ