Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1270716ybk; Thu, 14 May 2020 05:00:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqfMWtm6uhDNIB2ASlkoYtE3hHJ/mDmjUgUKBAkYAv1Wmt8sWijV0pM/BatkiJnzW7lG3P X-Received: by 2002:a50:fc04:: with SMTP id i4mr3727674edr.236.1589457625652; Thu, 14 May 2020 05:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589457625; cv=none; d=google.com; s=arc-20160816; b=vQh3AFtCCx2Va5JnORu8LLUnJh4qTR4LdjnCIcL91EEomVu3ZsjAM9GP8RoA4Q5y3q F4KUembGbX/zemTtESE/JPvVvvYKYDUWajts2/vgDZ5MdDC3syWtMqBRCVHKhVSlmz2h /chENpsLxxumyFqVao3eE+zv44fEhmp3D4VwEgB1pJ9gjEHFetf/ETUv9I+SVxXOo2aQ ktDPhy4U6N3IWzzwJQspirrhYkUsBTlIiI1nRh9Rfcfxd7Jg3BCB+Fy1TFrBWcvCaM3B gZ63yCk1hVCBL9g3b3Ym1s/toEkemMdDk+nS68G8b+XsxXKg0dic9GTswLaVQkYcd5qD ipiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6XcwKB8JT6CiG8wcCRTsABLQLCWk2INmdbdRd8lvlHU=; b=lhuS018zXpwPsMFEcn5mY7e9X6veYCNPI15b4NwpA64FkZLbT+EuLE9DL3k7zlkJRB 8p5w1wDdqRVRt2rk3lXxqf0gaFiw63PEv+ZP2I+23ZHcbyIWScsGxCCRUBDxGJ/GR2uH Mg2uI2OCPrCNjmHgQ33UIR6hNnDdlFIJWpQF4wlhJRRwBPsfmX1z9yeZGsJHKdPGgEdw DSzi7JX4fKlSL3kAqoJFBoVcad4AE7/oOmwXrKa2bAlDFNhExctvzT/AtWIUcdeYqpKf UrzfpivakkisGZKYhGPBK4/J6A82VugqiNPhRPRfYSVQOZ30RhQANdsWVhdzVYadcCE+ 2s/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si1455334eds.398.2020.05.14.05.00.00; Thu, 14 May 2020 05:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbgENL6d (ORCPT + 99 others); Thu, 14 May 2020 07:58:33 -0400 Received: from verein.lst.de ([213.95.11.211]:51537 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgENL6c (ORCPT ); Thu, 14 May 2020 07:58:32 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 7EA8E68BEB; Thu, 14 May 2020 13:58:29 +0200 (CEST) Date: Thu, 14 May 2020 13:58:29 +0200 From: Christoph Hellwig To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Hillf Danton , Thomas Gleixner , Jeremy Linton , syzbot+353be47c9ce21b68b7ed@syzkaller.appspotmail.com, stable Subject: Re: [PATCH] USB: usbfs: fix mmap dma mismatch Message-ID: <20200514115829.GA15995@lst.de> References: <20200514112711.1858252-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200514112711.1858252-1-gregkh@linuxfoundation.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Otherwise looks good: Reviewed-by: Christoph Hellwig