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: <20200514120944.GA2005274@kroah.com>
Date:   Thu, 14 May 2020 14:09:44 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Christoph Hellwig <hch@....de>
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Hillf Danton <hdanton@...a.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jeremy Linton <jeremy.linton@....com>,
        syzbot+353be47c9ce21b68b7ed@...kaller.appspotmail.com,
        stable <stable@...r.kernel.org>
Subject: Re: [PATCH] USB: usbfs: fix mmap dma mismatch

On Thu, May 14, 2020 at 01:58:29PM +0200, Christoph Hellwig wrote:
> On Thu, May 14, 2020 at 01:27:11PM +0200, Greg Kroah-Hartman wrote:
> > +	if (hcd->localmem_pool || !hcd_uses_dma(hcd)) {
> > +		if (remap_pfn_range(vma, vma->vm_start,
> > +				    virt_to_phys(usbm->mem) >> PAGE_SHIFT,
> > +				    size, vma->vm_page_prot) < 0) {
> > +			dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
> > +			return -EAGAIN;
> > +		}
> > +	} else {
> > +		if (dma_mmap_coherent(hcd->self.sysdev, vma, mem, dma_handle,
> > +				      size)) {
> > +			dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
> > +			return -EAGAIN;
> > +		}
> 
> What about a goto label to share the error handling path?

I thought about that, but that's a bit messier than the duplicated lines
here :)

> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@....de>

thanks for the review, and the help with this.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ