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] [day] [month] [year] [list]
Message-ID: <49f3bce6-dc9a-60c7-0772-010edb8d0363@hartkopp.net>
Date:   Fri, 9 Dec 2022 19:35:34 +0100
From:   Oliver Hartkopp <socketcan@...tkopp.net>
To:     stable@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     netdev@...r.kernel.org, linux-can@...r.kernel.org,
        syzbot+2d7f58292cb5b29eb5ad@...kaller.appspotmail.com,
        Wei Chen <harperchen1110@...il.com>
Subject: Re: [PATCH stable] can: af_can: fix NULL pointer dereference in
 can_rcv_filter

Just checked that the stable patch for 8aa59e355949 ("can: af_can: fix 
NULL pointer dereference in can_rx_register()") has been applied down to 
linux-5.4.y

Same works with this patch.

Just the current 6.1-rc has some changes in this section which makes 
this backport stable patch necessary.

Best,
Oliver


On 09.12.22 19:07, Oliver Hartkopp wrote:
> Analogue to commit 8aa59e355949 ("can: af_can: fix NULL pointer
> dereference in can_rx_register()") we need to check for a missing
> initialization of ml_priv in the receive path of CAN frames.
> 
> Since commit 4e096a18867a ("net: introduce CAN specific pointer in the
> struct net_device") the check for dev->type to be ARPHRD_CAN is not
> sufficient anymore since bonding or tun netdevices claim to be CAN
> devices but do not initialize ml_priv accordingly.
> 
> Upstream commit 0acc442309a0 ("can: af_can: fix NULL pointer
> dereference in can_rcv_filter")
> 
> Fixes: 4e096a18867a ("net: introduce CAN specific pointer in the struct net_device")
> Reported-by: syzbot+2d7f58292cb5b29eb5ad@...kaller.appspotmail.com
> Reported-by: Wei Chen <harperchen1110@...il.com>
> Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.net>
> Cc: stable@...r.kernel.org # 5.12 .. 6.0
> ---
>   net/can/af_can.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 1fb49d51b25d..4392f1d9c027 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -678,11 +678,11 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
>   static int can_rcv(struct sk_buff *skb, struct net_device *dev,
>   		   struct packet_type *pt, struct net_device *orig_dev)
>   {
>   	struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
>   
> -	if (unlikely(dev->type != ARPHRD_CAN || skb->len != CAN_MTU)) {
> +	if (unlikely(dev->type != ARPHRD_CAN || !can_get_ml_priv(dev) || skb->len != CAN_MTU)) {
>   		pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n",
>   			     dev->type, skb->len);
>   		goto free_skb;
>   	}
>   
> @@ -704,11 +704,11 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
>   static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,
>   		     struct packet_type *pt, struct net_device *orig_dev)
>   {
>   	struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
>   
> -	if (unlikely(dev->type != ARPHRD_CAN || skb->len != CANFD_MTU)) {
> +	if (unlikely(dev->type != ARPHRD_CAN || !can_get_ml_priv(dev) || skb->len != CANFD_MTU)) {
>   		pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n",
>   			     dev->type, skb->len);
>   		goto free_skb;
>   	}
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ