Stable Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/4] staging: gigaset: fix general protection fault on probe
       [not found] <20191129101753.9721-1-johan@kernel.org>
@ 2019-11-29 10:17 ` Johan Hovold
       [not found]   ` <20191201001505.964E72075A@mail.kernel.org>
  2019-11-29 10:17 ` [PATCH 2/4] staging: gigaset: fix illegal free on probe errors Johan Hovold
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2019-11-29 10:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, linux-usb, Johan Hovold,
	syzbot+35b1c403a14f5c89eba7, stable, Hansjoerg Lipp,
	Tilman Schmidt

Fix a general protection fault when accessing the endpoint descriptors
which could be triggered by a malicious device due to missing sanity
checks on the number of endpoints.

Reported-by: syzbot+35b1c403a14f5c89eba7@syzkaller.appspotmail.com
Fixes: 07dc1f9f2f80 ("[PATCH] isdn4linux: Siemens Gigaset drivers - M105 USB DECT adapter")
Cc: stable <stable@vger.kernel.org>     # 2.6.17
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/staging/isdn/gigaset/usb-gigaset.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/isdn/gigaset/usb-gigaset.c b/drivers/staging/isdn/gigaset/usb-gigaset.c
index 1b9b43659bdf..5e393e7dde45 100644
--- a/drivers/staging/isdn/gigaset/usb-gigaset.c
+++ b/drivers/staging/isdn/gigaset/usb-gigaset.c
@@ -685,6 +685,11 @@ static int gigaset_probe(struct usb_interface *interface,
 		return -ENODEV;
 	}
 
+	if (hostif->desc.bNumEndpoints < 2) {
+		dev_err(&interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
 	dev_info(&udev->dev, "%s: Device matched ... !\n", __func__);
 
 	/* allocate memory for our device state and initialize it */
-- 
2.24.0


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

* [PATCH 2/4] staging: gigaset: fix illegal free on probe errors
       [not found] <20191129101753.9721-1-johan@kernel.org>
  2019-11-29 10:17 ` [PATCH 1/4] staging: gigaset: fix general protection fault on probe Johan Hovold
@ 2019-11-29 10:17 ` Johan Hovold
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2019-11-29 10:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, linux-usb, Johan Hovold, stable, Tilman Schmidt

The driver failed to initialise its receive-buffer pointer, something
which could lead to an illegal free on late probe errors.

Fix this by making sure to clear all driver data at allocation.

Fixes: 2032e2c2309d ("usb_gigaset: code cleanup")
Cc: stable <stable@vger.kernel.org>     # 2.6.33
Cc: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/staging/isdn/gigaset/usb-gigaset.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/isdn/gigaset/usb-gigaset.c b/drivers/staging/isdn/gigaset/usb-gigaset.c
index 5e393e7dde45..a84722d83bc6 100644
--- a/drivers/staging/isdn/gigaset/usb-gigaset.c
+++ b/drivers/staging/isdn/gigaset/usb-gigaset.c
@@ -571,8 +571,7 @@ static int gigaset_initcshw(struct cardstate *cs)
 {
 	struct usb_cardstate *ucs;
 
-	cs->hw.usb = ucs =
-		kmalloc(sizeof(struct usb_cardstate), GFP_KERNEL);
+	cs->hw.usb = ucs = kzalloc(sizeof(struct usb_cardstate), GFP_KERNEL);
 	if (!ucs) {
 		pr_err("out of memory\n");
 		return -ENOMEM;
@@ -584,9 +583,6 @@ static int gigaset_initcshw(struct cardstate *cs)
 	ucs->bchars[3] = 0;
 	ucs->bchars[4] = 0x11;
 	ucs->bchars[5] = 0x13;
-	ucs->bulk_out_buffer = NULL;
-	ucs->bulk_out_urb = NULL;
-	ucs->read_urb = NULL;
 	tasklet_init(&cs->write_tasklet,
 		     gigaset_modem_fill, (unsigned long) cs);
 
-- 
2.24.0


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

* Re: [PATCH 1/4] staging: gigaset: fix general protection fault on probe
       [not found]   ` <20191201001505.964E72075A@mail.kernel.org>
@ 2019-12-01 12:30     ` Tilman Schmidt
  2019-12-01 12:41       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Tilman Schmidt @ 2019-12-01 12:30 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Sasha Levin, Greg Kroah-Hartman, devel, linux-kernel,
	Hansjoerg Lipp, stable

Hi Johan,

this is probably caused by the move of the driver to staging in
kernel release 5.3 half a year ago. If you want your patches to
apply to pre-5.3 stable releases you'll have to submit a version
with the paths changed from drivers/staging/isdn/gigaset to
drivers/isdn/gigaset.

HTH
Tilman

Am 01.12.2019 um 01:15 schrieb Sasha Levin:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: 07dc1f9f2f80 ("[PATCH] isdn4linux: Siemens Gigaset drivers - M105 USB DECT adapter").
> 
> The bot has tested the following trees: v5.4.1, v5.3.14, v4.19.86, v4.14.156, v4.9.205, v4.4.205.
> 
> v5.4.1: Build OK!
> v5.3.14: Build OK!
> v4.19.86: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.14.156: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.9.205: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.4.205: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?
> 

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

* Re: [PATCH 1/4] staging: gigaset: fix general protection fault on probe
  2019-12-01 12:30     ` Tilman Schmidt
@ 2019-12-01 12:41       ` Greg Kroah-Hartman
  2019-12-01 13:04         ` Johan Hovold
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-01 12:41 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Johan Hovold, Sasha Levin, devel, linux-kernel, Hansjoerg Lipp, stable

On Sun, Dec 01, 2019 at 01:30:42PM +0100, Tilman Schmidt wrote:
> Hi Johan,
> 
> this is probably caused by the move of the driver to staging in
> kernel release 5.3 half a year ago. If you want your patches to
> apply to pre-5.3 stable releases you'll have to submit a version
> with the paths changed from drivers/staging/isdn/gigaset to
> drivers/isdn/gigaset.

That's trivial for me to do when they get added to the stable tree(s),
no need to worry about it.

thanks,

greg k-h

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

* Re: [PATCH 1/4] staging: gigaset: fix general protection fault on probe
  2019-12-01 12:41       ` Greg Kroah-Hartman
@ 2019-12-01 13:04         ` Johan Hovold
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2019-12-01 13:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Tilman Schmidt, Johan Hovold, Sasha Levin, devel, linux-kernel,
	Hansjoerg Lipp, stable

On Sun, Dec 01, 2019 at 01:41:56PM +0100, Greg Kroah-Hartman wrote:
> On Sun, Dec 01, 2019 at 01:30:42PM +0100, Tilman Schmidt wrote:
> > Hi Johan,
> > 
> > this is probably caused by the move of the driver to staging in
> > kernel release 5.3 half a year ago. If you want your patches to
> > apply to pre-5.3 stable releases you'll have to submit a version
> > with the paths changed from drivers/staging/isdn/gigaset to
> > drivers/isdn/gigaset.
> 
> That's trivial for me to do when they get added to the stable tree(s),
> no need to worry about it.

I'll be sending a v2 of this series shortly. Somehow I managed to
overlook usb_endpoint_is_bulk_in() and friends so patch 4/4 should no
longer be needed either.

Johan

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191129101753.9721-1-johan@kernel.org>
2019-11-29 10:17 ` [PATCH 1/4] staging: gigaset: fix general protection fault on probe Johan Hovold
     [not found]   ` <20191201001505.964E72075A@mail.kernel.org>
2019-12-01 12:30     ` Tilman Schmidt
2019-12-01 12:41       ` Greg Kroah-Hartman
2019-12-01 13:04         ` Johan Hovold
2019-11-29 10:17 ` [PATCH 2/4] staging: gigaset: fix illegal free on probe errors Johan Hovold

Stable Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://lore.kernel.org/stable \
		stable@vger.kernel.org
	public-inbox-index stable

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git