linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thavatchai Makphaibulchoke <thavatchai.makpahibulchoke@hp.com>
To: Brad Mouring <bmouring@ni.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
	linux-rt-users@vger.kernel.org,
	Brad Mouring <brad.mouring@ni.com>
Subject: Re: [PATCH] rtmutex.c: Fix incorrect waiter check
Date: Mon, 15 Dec 2014 17:35:24 -0700	[thread overview]
Message-ID: <548F7E4C.90805@hp.com> (raw)
In-Reply-To: <1417808100-21626-1-git-send-email-brad.mouring@ni.com>

Yes, agreed.  Using the macro (), as done in the patch, is the correct
way to avoid invalid pointer dereferencing.

Tested with patch-3.14.25-rt22 patch on a 2 socket platform.

Reviewed-by: T Makphaibulchoke <tmac@hp.cojm>
Tested-by: T Makphaibulchoke <tmac@hp.cojm>


On 12/05/2014 12:35 PM, Brad Mouring wrote:
> In task_blocks_on_lock, there's a null check on pi_blocked_on
> of the task_struct. This pointer can encode the fact that the
> task that contains the pointer is waking (preventing requeuing)
> and therefore is non-null. Use the inline function to avoid
> dereferencing an invalid "pointer"
> 
> Signed-off-by: Brad Mouring <brad.mouring@ni.com>
> Reported-by: Ben Shelton <ben.shelton@ni.com>
> ---
>  kernel/locking/rtmutex.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
> index 6c40660..535321e 100644
> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -335,7 +335,8 @@ int max_lock_depth = 1024;
>  
>  static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p)
>  {
> -	return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL;
> +	return rt_mutex_real_waiter(p->pi_blocked_on) ?
> +		p->pi_blocked_on->lock : NULL;
>  }
>  
>  /*
> 

  reply	other threads:[~2014-12-16  0:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05 19:35 [PATCH] rtmutex.c: Fix incorrect waiter check Brad Mouring
2014-12-16  0:35 ` Thavatchai Makphaibulchoke [this message]
2015-01-14 21:11   ` [re: PATCH] " Brad Mouring
2015-01-14 21:11     ` [PATCH] " Brad Mouring
2015-01-21 20:13       ` Steven Rostedt
2015-02-17 16:10         ` Sebastian Andrzej Siewior
2015-08-17 10:41         ` AW: " eg Engleder Gerhard
2015-08-17 14:40           ` Steven Rostedt

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=548F7E4C.90805@hp.com \
    --to=thavatchai.makpahibulchoke@hp.com \
    --cc=bmouring@ni.com \
    --cc=brad.mouring@ni.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).