public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Hardy <shardy@redhat.com>
To: Greg KH <gregkh@suse.de>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>,
	Aristeu Rozanski <aris@redhat.com>,
	mjg@redhat.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] usb: qcserial add missing errorpath kfrees
Date: Mon, 04 Apr 2011 18:02:25 +0100	[thread overview]
Message-ID: <1301936545.4891.26.camel@shardy.csb> (raw)
In-Reply-To: <1301936257.4891.20.camel@shardy.csb>

There are two -ENODEV error paths in qcprobe where the allocated private
data is not freed, this patch adds the two missing kfrees to avoid
leaking memory on the error path

Signed-off-by: Steven Hardy <shardy@redhat.com>
---
Repost of qcserial patches posted last week, hopefully addresses review 
comments and email-patch-format issues

 drivers/usb/serial/qcserial.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index cd63864..54a9dab 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -167,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 					"Could not set interface, error %d\n",
 					retval);
 				retval = -ENODEV;
+				kfree(data);
 			}
 		} else if (ifnum == 2) {
 			dbg("Modem port found");
@@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
 					"Could not set interface, error %d\n",
 					retval);
 				retval = -ENODEV;
+				kfree(data);
 			}
 		}
 		break;
-- 
1.7.1




  parent reply	other threads:[~2011-04-04 17:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 14:06 [GIT PATCH] Fix memory leak in qcserial driver Steven Hardy
2011-03-28 14:21 ` Greg KH
2011-03-28 17:33   ` [GIT PATCH 1/3] Resend : " Steven Hardy
2011-03-28 17:38   ` [GIT PATCH 2/3] " Steven Hardy
2011-03-29 11:22     ` Sergei Shtylyov
2011-03-28 17:41   ` [GIT PATCH 3/3] " Steven Hardy
2011-03-28 22:16   ` [GIT PATCH 2/3 (2nd draft)] " Steven Hardy
2011-03-29 11:26     ` Sergei Shtylyov
2011-04-04 16:57       ` [PATCH 1/3] usb: Fix qcserial memory leak on rmmod Steven Hardy
2011-04-04 16:59         ` [PATCH 2/3] usb: qcserial avoid pointing to freed memory Steven Hardy
2011-04-04 17:02         ` Steven Hardy [this message]
2011-03-29 13:22     ` [GIT PATCH 2/3 (2nd draft)] Resend : Fix memory leak in qcserial driver Aristeu Rozanski
2011-03-28 17:34 ` [GIT PATCH] " Aristeu Rozanski
2011-03-28 17:48   ` Steven Hardy
2011-03-28 17:54     ` Aristeu Rozanski
2011-03-28 20:42       ` Steven Hardy

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=1301936545.4891.26.camel@shardy.csb \
    --to=shardy@redhat.com \
    --cc=aris@redhat.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=sshtylyov@mvista.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox