From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: Johan Hovold <johan@kernel.org>, stable <stable@vger.kernel.org>
Subject: [PATCH 2/5] USB: serial: garmin_gps: fix memory leak on probe errors
Date: Wed, 11 Oct 2017 14:02:58 +0200 [thread overview]
Message-ID: <20171011120301.25673-3-johan@kernel.org> (raw)
In-Reply-To: <20171011120301.25673-1-johan@kernel.org>
Make sure to free the port private data before returning after a failed
probe attempt.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/garmin_gps.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 8967de6623c4..677558c99a97 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1411,6 +1411,12 @@ static int garmin_port_probe(struct usb_serial_port *port)
usb_set_serial_port_data(port, garmin_data_p);
status = garmin_init_session(port);
+ if (status)
+ goto err_free;
+
+ return 0;
+err_free:
+ kfree(garmin_data_p);
return status;
}
--
2.14.2
next prev parent reply other threads:[~2017-10-11 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171011120301.25673-1-johan@kernel.org>
2017-10-11 12:02 ` [PATCH 1/5] USB: serial: garmin_gps: fix I/O after failed probe and remove Johan Hovold
2017-10-11 12:51 ` Greg KH
2017-10-11 13:27 ` Johan Hovold
2017-10-11 12:02 ` Johan Hovold [this message]
2017-10-11 12:52 ` [PATCH 2/5] USB: serial: garmin_gps: fix memory leak on probe errors Greg KH
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=20171011120301.25673-3-johan@kernel.org \
--to=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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.