public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: "Hans Verkuil" <hans.verkuil@cisco.com>,
	"Alexey Khoroshilov" <khoroshilov@ispras.ru>,
	"Alf Høgemark" <alf@i100.no>,
	"Peter Senna Tschudin" <peter.senna@gmail.com>,
	"Johannes Erdfelt" <johannes@erdfelt.com>,
	"Ezequiel Garcia" <elezegarcia@gmail.com>,
	"Matt Gomboc" <gomboc0@gmail.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch -next] [media] cx231xx: use after free on error path in probe
Date: Fri, 1 Nov 2013 13:34:40 +0300	[thread overview]
Message-ID: <20131101103440.GP29795@longonot.mountain> (raw)

We dereference "dev" after it has already been freed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index e9d017b..528cce9 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1412,8 +1412,8 @@ err_v4l2:
 	usb_set_intfdata(interface, NULL);
 err_if:
 	usb_put_dev(udev);
-	kfree(dev);
 	clear_bit(dev->devno, &cx231xx_devused);
+	kfree(dev);
 	return retval;
 }
 

                 reply	other threads:[~2013-11-01 10:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20131101103440.GP29795@longonot.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=alf@i100.no \
    --cc=elezegarcia@gmail.com \
    --cc=gomboc0@gmail.com \
    --cc=hans.verkuil@cisco.com \
    --cc=johannes@erdfelt.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=peter.senna@gmail.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