public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Stange <nicstange@gmail.com>
To: "Gaurav Jindal \(Gaurav Jindal\)" <Gaurav.Jindal@spreadtrum.com>
Cc: "tglx\@linutronix.de" <tglx@linutronix.de>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Sanjeev Yadav \(Sanjeev Kumar Yadav\)" 
	<Sanjeev.Yadav@spreadtrum.com>
Subject: Re: [PATCH]optimize error handling in tick_check_new_device
Date: Wed, 27 Jul 2016 14:23:18 +0200	[thread overview]
Message-ID: <87d1lz5ky1.fsf@gmail.com> (raw)
In-Reply-To: <20160727120609.GA3773@gauravjindalubtnb.del.spreadtrum.com> (Gaurav Jindal's message of "Wed, 27 Jul 2016 12:06:17 +0000")

"Gaurav Jindal (Gaurav Jindal)" <Gaurav.Jindal@spreadtrum.com> writes:
> diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
> index 4fcd99e..23faf4a 100644
> --- a/kernel/time/tick-common.c
> +++ b/kernel/time/tick-common.c
> @@ -307,6 +307,9 @@ void tick_check_new_device(struct clock_event_device *newdev)
>  	td = &per_cpu(tick_cpu_device, cpu);
>  	curdev = td->evtdev;


>
> +	if (!try_module_get(newdev->owner))
> +		return;
> +

Doesn't this leak a reference to newdev->owner if one of the following
conditions hold?

>  	/* cpu local device ? */
>  	if (!tick_check_percpu(curdev, newdev, cpu))
>  		goto out_bc;
> @@ -315,8 +318,6 @@ void tick_check_new_device(struct clock_event_device *newdev)
>  	if (!tick_check_preferred(curdev, newdev))
>  		goto out_bc;



> -	if (!try_module_get(newdev->owner))
> -		return;
>

Thanks,

Nicolai

  reply	other threads:[~2016-07-27 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 12:06 [PATCH]optimize error handling in tick_check_new_device Gaurav Jindal (Gaurav Jindal)
2016-07-27 12:23 ` Nicolai Stange [this message]
2016-07-28 14:50 ` Thomas Gleixner

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=87d1lz5ky1.fsf@gmail.com \
    --to=nicstange@gmail.com \
    --cc=Gaurav.Jindal@spreadtrum.com \
    --cc=Sanjeev.Yadav@spreadtrum.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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