All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yavuz, Tuba" <tuba@ece.ufl.edu>
To: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Cc: Greg KH <greg@kroah.com>
Subject: [PATCH] : media : hackrf : memory leak
Date: Sun, 27 Jan 2019 22:57:43 +0000	[thread overview]
Message-ID: <1548629863510.35899@ece.ufl.edu> (raw)


     
Due to a missing v4l2_device_get function in the hackrf_probe function, 
the reference count of the v4l2_device object reaches zero inside the 
wrong API function (video_unregister_device) instead of v4l2_device_put. 
This causes a memory leak as the release callback would not get called.


Reported-by: Tuba Yavuz <tuba@ece.ufl.edu>
Signed-off-by: Tuba Yavuz <tuba@ece.ufl.edu>
---


--- drivers/media/usb/hackrf/hackrf.c.orig	2019-01-26 11:37:18.912210823 -0500
+++ drivers/media/usb/hackrf/hackrf.c	2019-01-27 17:50:41.660736688 -0500
@@ -1524,6 +1524,7 @@ static int hackrf_probe(struct usb_inter
 			"Failed to register as video device (%d)\n", ret);
 		goto err_video_unregister_device_rx;
 	}
+	v4l2_device_get(&dev->v4l2_dev);
 	dev_info(dev->dev, "Registered as %s\n",
 		 video_device_node_name(&dev->tx_vdev));​
 

             reply	other threads:[~2019-01-27 22:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 22:57 Yavuz, Tuba [this message]
2019-01-28 14:10 ` [PATCH] : media : hackrf : memory leak Hans Verkuil
2019-01-28 16:23   ` Yavuz, Tuba

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=1548629863510.35899@ece.ufl.edu \
    --to=tuba@ece.ufl.edu \
    --cc=greg@kroah.com \
    --cc=linux-media@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.