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: <xa1tfujidqou.fsf@mina86.com>
Date:   Mon, 13 Feb 2017 17:02:41 +0100
From:   Michal Nazarewicz <mina86@...a86.com>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     gregkh@...uxfoundation.org, balbi@...nel.org,
        heikki.krogerus@...ux.intel.com, mail@...oabal.eu,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Peter Senna Tschudin <peter.senna@...il.com>
Subject: Re: [PATCH v2] usb: gadget: udc: remove pointer dereference after free

On Sat, Feb 11 2017, Gustavo A. R. Silva wrote:
> Remove pointer dereference after free and set pointer to NULL after free.
>
> Addresses-Coverity-ID: 1091173
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>

Acked-by: Michal Nazarewicz <mina86@...a86.com>

> ---
> Changes in v2:
>   Move pointer dereference before pci_pool_free()
>   Set pointer to NULL after free
>
>   drivers/usb/gadget/udc/pch_udc.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/pch_udc.c  
> b/drivers/usb/gadget/udc/pch_udc.c
> index a97da64..73bb58f 100644
> --- a/drivers/usb/gadget/udc/pch_udc.c
> +++ b/drivers/usb/gadget/udc/pch_udc.c
> @@ -1522,8 +1522,9 @@ static void pch_udc_free_dma_chain(struct  
> pch_udc_dev *dev,
>   		/* do not free first desc., will be done by free for request */
>   		td = phys_to_virt(addr);
>   		addr2 = (dma_addr_t)td->next;
> -		pci_pool_free(dev->data_requests, td, addr);
>   		td->next = 0x00;

Or just drop this.  pci_pool_free doesn’t care about contents of td.
It’s just a void* for it. 

> +		pci_pool_free(dev->data_requests, td, addr);
> +		td = NULL;

This isn’t necessary either.  td will get overwritten on next iteration
and once we’re done it’s not used again.

>   		addr = addr2;
>   	}
>   	req->chain_len = 1;

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ