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: <20200902125827.GA8817@duo.ucw.cz>
Date:   Wed, 2 Sep 2020 14:58:27 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Alan Stern <stern@...land.harvard.edu>,
        syzbot+c2c3302f9c601a4b1be2@...kaller.appspotmail.com
Subject: Re: [PATCH 4.19 108/125] USB: yurex: Fix bad gfp argument

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) <pavel@...x.de>

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

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ