Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp537784pxk; Wed, 2 Sep 2020 08:14:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxePTRrElWJdf20YTuKBpCdExzJZtsS6OMR90+wckPciGZ2vssoB17fdy2SFCpJ7wFe7FUQ X-Received: by 2002:a17:906:1719:: with SMTP id c25mr461490eje.487.1599059695119; Wed, 02 Sep 2020 08:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599059695; cv=none; d=google.com; s=arc-20160816; b=NjmgM8g9ggY6wGkXmpY+5XrPyL5UXYFZHEomAhFjNGnPHt+Mu5ugQ/cjnO0S5a77Pe f8IIISMkMeV9rtG25KLcvYjaDDGjDc69fNRQYOVSCA5SzWkcO4Rwq5Le6eCTnKftaChV wEaz7/lOkx5mhMkFVMp5yzQBCPZ/hLhp/8yn+4KbVwAw//rIZFLHKpEuCLtg5Jx4J6Vt +gY83MGWjsOh00QT4qvNhbmp2sehzNb9YQShLkU8PmT5mDOvEFRT11/aF5xbV4bPAaEz FrKJmFrP9jiIRd6VnFBJPUNuYXf3O2XUBDXObrXQvrVylLPG6/wPsgQxEMIwImRFfauz H/SQ== 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=NDUFVQoXbbYg38+8m90+4mJvRJ64PrTypwadKRLks34=; b=rNfkQGFYXh/F1lvX84R6x3F/hklJ4rmTqyk9+3aJax/GDEg8gXgor27g3O8YTOnilL ijfGh1x5YxoL7vmdmUgj7jdkBSwAuwP/TUbtu+kDiLmr2yffjJlEbZmlnlC8qTCCL/V0 S0UF7IOWLRKPwU03DgF+oV2w8gcfRTS1vtZ8zSjS8PD797/H0v9vOou4UCjC0y1vPr3u rKQkdNoQANYujw06mVQiHeAfnHujY1XIPbC5K23MuVeCSXp7BQPQT5BY6G6pYHEdP9Og aY0G3SbRQQ9xjTDs9x1Qpg/AyekruIf+g9iZlL0jt2rwRwd3G7j8T8y+aPzZQJBt7uFf BhoQ== 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 a1si2738080edn.356.2020.09.02.08.14.32; Wed, 02 Sep 2020 08:14:55 -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 S1728045AbgIBPNX (ORCPT + 99 others); Wed, 2 Sep 2020 11:13:23 -0400 Received: from netrider.rowland.org ([192.131.102.5]:42217 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727961AbgIBPMk (ORCPT ); Wed, 2 Sep 2020 11:12:40 -0400 Received: (qmail 626110 invoked by uid 1000); 2 Sep 2020 11:12:33 -0400 Date: Wed, 2 Sep 2020 11:12:33 -0400 From: Alan Stern To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+c2c3302f9c601a4b1be2@syzkaller.appspotmail.com Subject: Re: [PATCH 4.19 108/125] USB: yurex: Fix bad gfp argument Message-ID: <20200902151233.GC624583@rowland.harvard.edu> References: <20200901150934.576210879@linuxfoundation.org> <20200901150939.905188730@linuxfoundation.org> <20200902125827.GA8817@duo.ucw.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200902125827.GA8817@duo.ucw.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 02, 2020 at 02:58:27PM +0200, Pavel Machek wrote: > Hi! > > > The syzbot fuzzer identified a bug in the yurex driver: It passes > > GFP_KERNEL as a memory-allocation flag to usb_submit_urb() at a time > > when its state is TASK_INTERRUPTIBLE, not TASK_RUNNING: > > Yeah, and instead of fixing the bug, patch papers over it, reducing > reliability of the driver in the process. > > > This patch changes the call to use GFP_ATOMIC instead of GFP_KERNEL. > > Fixing it properly should be as simple as moving prepare_to_wait down, > no? Sigh. That never occurred to me, but of course it is right. Acked-by: Alan Stern Alan Stern > Signed-off-by: Pavel Machek (CIP) > > diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c > index 785080f79073..5fbbb57e6e95 100644 > --- a/drivers/usb/misc/yurex.c > +++ b/drivers/usb/misc/yurex.c > @@ -489,10 +489,10 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, > } > > /* send the data as the control msg */ > - prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); > dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__, > dev->cntl_buffer[0]); > - retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC); > + retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL); > + prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); > if (retval >= 0) > timeout = schedule_timeout(YUREX_WRITE_TIMEOUT); > finish_wait(&dev->waitq, &wait); > > > Best regards, > Pavel > > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html