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:   Thu, 26 Jul 2018 18:02:16 +0200
From:   Björn Töpel <bjorn.topel@...il.com>
To:     Taehee Yoo <ap420073@...il.com>
Cc:     Daniel Borkmann <daniel@...earbox.net>, ast@...nel.org,
        Netdev <netdev@...r.kernel.org>,
        Björn Töpel <bjorn.topel@...el.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>, kafai@...com,
        Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: Re: [PATCH V3 bpf] xdp: add NULL pointer check in __xdp_return()

Den tors 26 juli 2018 kl 16:18 skrev Taehee Yoo <ap420073@...il.com>:
>
> rhashtable_lookup() can return NULL. so that NULL pointer
> check routine should be added.
>

Thanks Taehee!

Acked-by: Björn Töpel <bjorn.topel@...el.com>

> Fixes: 02b55e5657c3 ("xdp: add MEM_TYPE_ZERO_COPY")
> Acked-by: Martin KaFai Lau <kafai@...com>
> Signed-off-by: Taehee Yoo <ap420073@...il.com>
> ---
> V3 : reduce code line
> V2 : add WARN_ON_ONCE when xa is NULL.
>  net/core/xdp.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index 9d1f220..6771f18 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -345,7 +345,8 @@ static void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
>                 rcu_read_lock();
>                 /* mem->id is valid, checked in xdp_rxq_info_reg_mem_model() */
>                 xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
> -               xa->zc_alloc->free(xa->zc_alloc, handle);
> +               if (!WARN_ON_ONCE(!xa))
> +                       xa->zc_alloc->free(xa->zc_alloc, handle);
>                 rcu_read_unlock();
>         default:
>                 /* Not possible, checked in xdp_rxq_info_reg_mem_model() */
> --
> 2.9.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ