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  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]
Date:   Tue, 8 Jan 2019 15:58:40 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Jeff Dike <jdike@...toit.com>, Richard Weinberger <richard@....at>,
        anton.ivanov@...bridgegreys.com,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        YueHaibing <yuehaibing@...wei.com>, linux-um@...ts.infradead.org,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] um: vector: Fix a potential NULL pointer dereference
 in 'vector_net_open()'

On Fri, Dec 28, 2018 at 1:57 AM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> 'create_queue()' returns NULL in case of memory allocation failure. So we
> must check if it succeeds in order to avoid potential NULL pointer
> dereference.
>
> For 'vp->rx_queue', the dereference would occur just one line after the
> failed allocation. For 'vp->tx_queue', it would occur later during normal
> processing.
>
> Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Reviewed-by: Kees Cook <keescook@...omium.org>

-Kees

> ---
>  arch/um/drivers/vector_kern.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index 046fa9ea0ccc..5b917716289d 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -1182,6 +1182,8 @@ static int vector_net_open(struct net_device *dev)
>                         vp->rx_header_size,
>                         MAX_IOV_SIZE
>                 );
> +               if (!vp->rx_queue)
> +                       goto out_close;
>                 vp->rx_queue->queue_depth = get_depth(vp->parsed);
>         } else {
>                 vp->header_rxbuffer = kmalloc(
> @@ -1198,6 +1200,8 @@ static int vector_net_open(struct net_device *dev)
>                         vp->header_size,
>                         MAX_IOV_SIZE
>                 );
> +               if (!vp->tx_queue)
> +                       goto out_close;
>         } else {
>                 vp->header_txbuffer = kmalloc(vp->header_size, GFP_KERNEL);
>                 if (vp->header_txbuffer == NULL)
> --
> 2.19.1
>


-- 
Kees Cook

Powered by blists - more mailing lists