summaryrefslogtreecommitdiff
blob: 652065e38790f97f54dd55eb1cc77772077ae954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Tejun Heo <htejun@gmail.com>
Date: Mon, 11 Jun 2007 05:03:27 +0000 (+0900)
Subject: sysfs: fix condition check in sysfs_drop_dentry()
X-Git-Tag: v2.6.22-rc5~46
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=6aa054aadfea613a437ad0b15d38eca2b963fc0a

sysfs: fix condition check in sysfs_drop_dentry()

The condition check doesn't make much sense as it basically always
succeeds.  This causes NULL dereferencing on certain cases.  It seems
that parentheses are put in the wrong place.  Fix it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---

Adjusted to apply to Debian's 2.6.18 by dann frazier <dannf@hp.com>

--- linux-source-2.6.18+2.6.22.y/fs/sysfs/inode.c.orig	2007-11-07 15:40:19.000000000 -0700
+++ linux-source-2.6.18+2.6.22.y/fs/sysfs/inode.c	2007-11-07 17:09:33.000000000 -0700
@@ -236,7 +236,7 @@ void sysfs_drop_dentry(struct sysfs_dire
 	if (dentry) {
 		spin_lock(&dcache_lock);
 		spin_lock(&dentry->d_lock);
-		if (!(d_unhashed(dentry) && dentry->d_inode)) {
+		if (!d_unhashed(dentry) && dentry->d_inode) {
 			dget_locked(dentry);
 			__d_drop(dentry);
 			spin_unlock(&dentry->d_lock);