linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Hans Verkuil (hansverk)" <hansverk@cisco.com>
To: Wen Yang <yellowriver2010@hotmail.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] media: cec-notifier: fix possible object reference leak
Date: Mon, 11 Feb 2019 10:38:53 +0000	[thread overview]
Message-ID: <3ed515b78a404ec4a22b5f69ed9d6e28@XCH-ALN-012.cisco.com> (raw)
In-Reply-To: HK0PR02MB363461179B3A702DB9CAEC55B26A0@HK0PR02MB3634.apcprd02.prod.outlook.com

On 09/02/2019 03:48, Wen Yang wrote:
> put_device() should be called in cec_notifier_release(),
> since the dev is being passed down to cec_notifier_get_conn(),
> which holds reference. On cec_notifier destruction, it
> should drop the reference to the device.
> 
> Fixes: 6917a7b77413 ("[media] media: add CEC notifier support")
> Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
> ---
>  drivers/media/cec/cec-notifier.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-notifier.c
> index dd2078b..621d4ae 100644
> --- a/drivers/media/cec/cec-notifier.c
> +++ b/drivers/media/cec/cec-notifier.c
> @@ -66,6 +66,7 @@ static void cec_notifier_release(struct kref *kref)
>  		container_of(kref, struct cec_notifier, kref);
>  
>  	list_del(&n->head);
> +	put_device(n->dev);
>  	kfree(n->conn);
>  	kfree(n);
>  }
> 

Sorry, no. The dev pointer is just a search key that the notifier code looks
for. It is not the notifier's responsibility to take a reference, that would
be the responsibility of the hdmi and cec drivers.

If you can demonstrate that there is an object reference leak, then please
provide the details: it is likely a bug elsewhere and not in the notifier
code.

BTW, your patch series didn't arrive on the linux-media mailinglist for
some reason.

Regards,

	Hans

       reply	other threads:[~2019-02-11 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <HK0PR02MB363461179B3A702DB9CAEC55B26A0@HK0PR02MB3634.apcprd02.prod.outlook.com>
2019-02-11 10:38 ` Hans Verkuil (hansverk) [this message]
2019-02-11 10:57   ` [PATCH 1/4] media: cec-notifier: fix possible object reference leak Hans Verkuil (hansverk)
     [not found]     ` <HK0PR02MB3634D1937109CD28ECBF1654B2650@HK0PR02MB3634.apcprd02.prod.outlook.com>
2019-02-12 13:39       ` 答复: " Hans Verkuil (hansverk)

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=3ed515b78a404ec4a22b5f69ed9d6e28@XCH-ALN-012.cisco.com \
    --to=hansverk@cisco.com \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=yellowriver2010@hotmail.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;
as well as URLs for NNTP newsgroup(s).