From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable <stable@vger.kernel.org>, Tilman Schmidt <tilman@imap.cc>
Subject: [PATCH 2/4] staging: gigaset: fix illegal free on probe errors
Date: Fri, 29 Nov 2019 11:17:51 +0100 [thread overview]
Message-ID: <20191129101753.9721-3-johan@kernel.org> (raw)
In-Reply-To: <20191129101753.9721-1-johan@kernel.org>
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
next prev parent reply other threads:[~2019-11-29 10:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 10:17 [PATCH 0/4] staging: gigaset: fix crashes on probe Johan Hovold
2019-11-29 10:17 ` [PATCH 1/4] staging: gigaset: fix general protection fault " 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 ` Johan Hovold [this message]
2019-11-29 10:17 ` [PATCH 3/4] staging: gigaset: add endpoint-type sanity check Johan Hovold
2019-11-29 10:17 ` [PATCH 4/4] staging: gigaset: rename endpoint-descriptor identifier Johan Hovold
2019-11-29 13:32 ` [PATCH 0/4] staging: gigaset: fix crashes on probe Greg Kroah-Hartman
2019-11-29 13:51 ` Johan Hovold
2019-11-29 14:23 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191129101753.9721-3-johan@kernel.org \
--to=johan@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tilman@imap.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.