mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] isdn/gigaset: check endpoint null in gigaset_probe
@ 2019-07-26 13:35 Phong Tran
  2019-07-26 14:22 ` Paul Bolle
  0 siblings, 1 reply; 4+ messages in thread
From: Phong Tran @ 2019-07-26 13:35 UTC (permalink / raw)
  To: pebolle, isdn, gregkh
  Cc: gigaset307x-common, netdev, linux-kernel, linux-kernel-mentees,
	Phong Tran, syzbot+35b1c403a14f5c89eba7

This fixed the potential reference NULL pointer while using variable
endpoint.

Reported-by: syzbot+35b1c403a14f5c89eba7@syzkaller.appspotmail.com
Tested by syzbot:
https://groups.google.com/d/msg/syzkaller-bugs/wnHG8eRNWEA/Qn2HhjNdBgAJ

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
 drivers/isdn/gigaset/usb-gigaset.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 1b9b43659bdf..2e011f3db59e 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -703,6 +703,10 @@ static int gigaset_probe(struct usb_interface *interface,
 	usb_set_intfdata(interface, cs);
 
 	endpoint = &hostif->endpoint[0].desc;
+        if (!endpoint) {
+		dev_err(cs->dev, "Couldn't get control endpoint\n");
+		return -ENODEV;
+	}
 
 	buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
 	ucs->bulk_out_size = buffer_size;
@@ -722,6 +726,11 @@ static int gigaset_probe(struct usb_interface *interface,
 	}
 
 	endpoint = &hostif->endpoint[1].desc;
+        if (!endpoint) {
+		dev_err(cs->dev, "Endpoint not available\n");
+		retval = -ENODEV;
+		goto error;
+	}
 
 	ucs->busy = 0;
 
-- 
2.20.1


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

end of thread, other threads:[~2019-07-27  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 13:35 [PATCH] isdn/gigaset: check endpoint null in gigaset_probe Phong Tran
2019-07-26 14:22 ` Paul Bolle
2019-07-27  1:56   ` Phong Tran
2019-07-27  9:36     ` Paul Bolle

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

all inboxes | Powered by JetHome®