public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: usbfs: fix crash in check_ctrlrecip()->usb_find_alt_setting()
@ 2018-09-25 12:22 Vladis Dronov
  2018-09-25 14:14 ` Alan Stern
  0 siblings, 1 reply; 9+ messages in thread
From: Vladis Dronov @ 2018-09-25 12:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern, Oliver Neukum, Hans de Goede,
	syzkaller, linux-usb, linux-kernel
  Cc: stable, Vladis Dronov

ps->dev->actconfig can be NULL and cause NULL-deref in usb_find_alt_setting()
before c9a4cb204e9e. fix this anyway by checking that ps->dev->actconfig is not
NULL, so usb_find_alt_setting() is not called with a known-bad argument.

Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Reported-by: syzbot+19c3aaef85a89d451eac@syzkaller.appspotmail.com
---
 drivers/usb/core/devio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 6ce77b33da61..26047620b003 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -824,7 +824,7 @@ static int check_ctrlrecip(struct usb_dev_state *ps, unsigned int requesttype,
 	 * class specification, which we always want to allow as it is used
 	 * to query things like ink level, etc.
 	 */
-	if (requesttype == 0xa1 && request == 0) {
+	if (requesttype == 0xa1 && request == 0 && ps->dev->actconfig) {
 		alt_setting = usb_find_alt_setting(ps->dev->actconfig,
 						   index >> 8, index & 0xff);
 		if (alt_setting
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-09-26  8:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-25 12:22 [PATCH] usb: usbfs: fix crash in check_ctrlrecip()->usb_find_alt_setting() Vladis Dronov
2018-09-25 14:14 ` Alan Stern
2018-09-25 14:55   ` Vladis Dronov
2018-09-25 15:15     ` Alan Stern
2018-09-25 15:17       ` Andrey Konovalov
2018-09-25 17:54         ` Alan Stern
2018-09-25 18:55           ` Vladis Dronov
2018-09-25 20:44             ` Alan Stern
2018-09-26  8:22               ` Vladis Dronov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox