Re: [PATCH 1/4] rtmutex: avoid null derefence in WARN_ON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/09/2010 05:29 PM, Steven Rostedt wrote:
On Fri, 2010-07-09 at 15:32 -0700, Darren Hart wrote:
If the pi_blocked_on variable is NULL, the subsequent WARN_ON's
will cause an OOPS. Only perform the susequent checks if
pi_blocked_on is valid.

Signed-off-by: Darren Hart<dvhltc@xxxxxxxxxx>
Cc: Thomas Gleixner<tglx@xxxxxxxxxxxxx>
Cc: Peter Zijlstra<peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar<mingo@xxxxxxx>
Cc: Eric Dumazet<eric.dumazet@xxxxxxxxx>
Cc: John Kacur<jkacur@xxxxxxxxxx>
Cc: Steven Rostedt<rostedt@xxxxxxxxxxx>
Cc: Mike Galbraith<efault@xxxxxx>
---
  kernel/rtmutex.c |    7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 23dd443..baac7d9 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -579,9 +579,10 @@ static void wakeup_next_waiter(struct rt_mutex *lock, int savestate)

  	raw_spin_lock(&pendowner->pi_lock);

-	WARN_ON(!pendowner->pi_blocked_on);
-	WARN_ON(pendowner->pi_blocked_on != waiter);
-	WARN_ON(pendowner->pi_blocked_on->lock != lock);
+	if (!WARN_ON(!pendowner->pi_blocked_on)) {
+		WARN_ON(pendowner->pi_blocked_on != waiter);

The above actually has no issue if the pi_blocked_on is NULL.

It doesn't, but it's also redundant and makes the console noisier for no reason. Seemed worth while to drop it under the if in the same go.

--
Darren


The below, well yeah.

-- Steve

+		WARN_ON(pendowner->pi_blocked_on->lock != lock);
+	}

  	pendowner->pi_blocked_on = NULL;





--
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux