mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: jirislaby@gmail.com
Cc: linux-kernel@vger.kernel.org, Sean Young <sean@mess.org>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	linux-media@vger.kernel.org
Subject: [PATCH 2/5] MEDIA: ttusbir, fix double free
Date: Thu,  4 Apr 2013 22:32:09 +0200	[thread overview]
Message-ID: <1365107532-32721-2-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1365107532-32721-1-git-send-email-jslaby@suse.cz>

rc_unregister_device already calls rc_free_device to free the passed
device. But in one of ttusbir's probe fail paths, we call
rc_unregister_device _and_ rc_free_device. This is wrong and results
in a double free.

Instead, set rc to NULL resulting in rc_free_device being a noop.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Sean Young <sean@mess.org>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
---
 drivers/media/rc/ttusbir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index cf0d47f..891762d 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -347,6 +347,7 @@ static int ttusbir_probe(struct usb_interface *intf,
 	return 0;
 out3:
 	rc_unregister_device(rc);
+	rc = NULL;
 out2:
 	led_classdev_unregister(&tt->led);
 out:
-- 
1.8.2



  reply	other threads:[~2013-04-04 20:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
2013-04-04 20:32 ` Jiri Slaby [this message]
2013-04-09 10:36   ` [PATCH 2/5] MEDIA: ttusbir, fix double free Sean Young
2013-04-04 20:32 ` [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable Jiri Slaby
2013-04-05  5:20   ` Takashi Iwai
2013-04-04 20:32 ` [PATCH 4/5] X86: boot, close opened descriptor Jiri Slaby
2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
2013-04-04 22:37   ` Jiri Kosina
2013-04-04 23:05   ` Nikola Pajkovsky
2013-04-04 22:53 ` [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Nikola Pajkovsky

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=1365107532-32721-2-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=sean@mess.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 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®