Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp439848pxk; Wed, 2 Sep 2020 05:59:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySSpq+Y0Hk+4eb90Q3KGUIQuQGXnXPn/sDnUn8XbhjQQyWrQiwUKTJL82/G7veUhRaBOCv X-Received: by 2002:a17:906:11d2:: with SMTP id o18mr6016093eja.420.1599051584796; Wed, 02 Sep 2020 05:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599051584; cv=none; d=google.com; s=arc-20160816; b=K0bmyQTfNHO2sBjI0dqFD0cRykd4SaSjHPl3MBDELjR89xhYCQr4CZ7+WusmxwRcDC AXiVivgarapAyAkg7Lr3ueMlocjMKDLp3JPWemjxLBxQIeVmBU5yP/dpQTUqhEntZ8CH qpJEE6/zyj+TocslZwVP03Awq0yyGCRxmGpbLTIRoh6+dsgbKbYeIpE8iyPKoVt8H8sk 4llbegYq6Z977xEFHbJZjFGJ2s7pPxgYgO3lecqdIabRNRm3jl2GWch7TcMLlqqJiL6j 2OlG8tKezELGkm+vQ1ZZlW69oUK9P575p9xwaYdJVWS+2PMnshRtWUfsck0/f5fd068o I+iw== 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=vI9xCfDm/8u93A1Q7FRafgue4rrFB6nZHApnS5U5ZII=; b=ZZUNsqbyfJV+lkyxI2fn6kwVUvtIU8rU6EXsQvZgLzIn6zHqXDVfxqTdOYJbXct/vu rQo3qnoZjFdmJGSbGw+yezCGJqJQYc2RA8Qz5q5pkT4FNgZ/UqTsmiARuVhW/R0nbgX5 rtTfA8/wKaq3imnS764BZLOrh0J5RARV05ZwNol+G0GS5HOvB2yYVg08H6evPWjEvMIf pHpsOfHOl9KBsRw9lZZQnonYLmCtZzAUY9SRiMMX5ONaHuevhwRww/t1i+ZBekLbKjQg P+C0dwg5Drnn1HHfGLXI0099Xx9UNrcmQWEglKJTVBKDtPX4q4Ftt2Rh3RDEvjPSIg+P Ek0g== 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 k25si2572677ejq.407.2020.09.02.05.59.22; Wed, 02 Sep 2020 05:59:44 -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 S1726307AbgIBM6g (ORCPT + 99 others); Wed, 2 Sep 2020 08:58:36 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:33630 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgIBM6c (ORCPT ); Wed, 2 Sep 2020 08:58:32 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 95F651C0B7F; Wed, 2 Sep 2020 14:58:28 +0200 (CEST) Date: Wed, 2 Sep 2020 14:58:27 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Alan Stern , syzbot+c2c3302f9c601a4b1be2@syzkaller.appspotmail.com Subject: Re: [PATCH 4.19 108/125] USB: yurex: Fix bad gfp argument Message-ID: <20200902125827.GA8817@duo.ucw.cz> References: <20200901150934.576210879@linuxfoundation.org> <20200901150939.905188730@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline In-Reply-To: <20200901150939.905188730@linuxfoundation.org> 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 --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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? 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 c= har __user *user_buffer, } =20 /* 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 =3D usb_submit_urb(dev->cntl_urb, GFP_ATOMIC); + retval =3D usb_submit_urb(dev->cntl_urb, GFP_KERNEL); + prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); if (retval >=3D 0) timeout =3D schedule_timeout(YUREX_WRITE_TIMEOUT); finish_wait(&dev->waitq, &wait); Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCX0+W8wAKCRAw5/Bqldv6 8qhCAKCALokkNqTK/gKXORopIw1iBG/XuwCguq4niA/xdb8rAIcmbmunTeGsIu0= =PAfh -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy--