linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: mchehab@kernel.org, andreyknvl@google.com, kcc@google.com,
	dvyukov@google.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: [RFT] [media] em28xx: Fix use-after-free in v4l2_fh_init
Date: Thu,  9 Nov 2017 11:19:12 +0530	[thread overview]
Message-ID: <47c1c53ffe47fbd34a3f1aae92391e7ff5a0aab8.1510205498.git.arvind.yadav.cs@gmail.com> (raw)

Here, em28xx_free_v4l2 is release "v4l2->dev->v4l2"
Which is allready release by em28xx_v4l2_init.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
This bug report by Andrey Konovalov "net/media/em28xx: use-after-free in v4l2_fh_init"

 drivers/media/usb/em28xx/em28xx-video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 8d253a5..f1ee53f 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2785,8 +2785,8 @@ static int em28xx_v4l2_init(struct em28xx *dev)
 	v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
 	v4l2_device_unregister(&v4l2->v4l2_dev);
 err:
-	dev->v4l2 = NULL;
 	kref_put(&v4l2->ref, em28xx_free_v4l2);
+	dev->v4l2 = NULL;
 	mutex_unlock(&dev->lock);
 	return ret;
 }
-- 
1.9.1

             reply	other threads:[~2017-11-09  5:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09  5:49 Arvind Yadav [this message]
2017-11-09 13:07 ` [RFT] [media] em28xx: Fix use-after-free in v4l2_fh_init Andrey Konovalov

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=47c1c53ffe47fbd34a3f1aae92391e7ff5a0aab8.1510205498.git.arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).