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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 29 Nov 2022 21:23:07 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Aleksandr Burakov <a.burakov@...alinux.ru>,
        Derek Chickles <dchickles@...vell.com>,
        Satanand Burla <sburla@...vell.com>,
        Felix Manlunas <fmanlunas@...vell.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH] liquidio: avoid NULL pointer dereference in
 lio_vf_rep_copy_packet()

On Mon, 28 Nov 2022 13:26:59 +0300 Aleksandr Burakov wrote:
> --- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
> @@ -272,13 +272,12 @@ lio_vf_rep_copy_packet(struct octeon_device *oct,
>  				pg_info->page_offset;
>  			memcpy(skb->data, va, MIN_SKB_SIZE);
>  			skb_put(skb, MIN_SKB_SIZE);
> +			skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
> +					pg_info->page,
> +					pg_info->page_offset + MIN_SKB_SIZE,
> +					len - MIN_SKB_SIZE,
> +					LIO_RXBUFFER_SZ);
>  		}
> -
> -		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
> -				pg_info->page,
> -				pg_info->page_offset + MIN_SKB_SIZE,
> -				len - MIN_SKB_SIZE,
> -				LIO_RXBUFFER_SZ);
>  	} else {
>  		struct octeon_skb_page_info *pg_info =
>  			((struct octeon_skb_page_info *)(skb->cb));

The else branch also looks at pg_info and derefs page like there's 
no tomorrow. You need to put a bit more effort into the analysis.

Marvell people please chime in and tell us what the intention is here.
Whether page can be NULL here or this is defensive programming and can
be dropped.

Powered by blists - more mailing lists