Skip to contentSkip to conversation

Fix messed hunks in generic_setlease

PATCH In review Pavel Emelyanov 3 participants 4 messages Sep 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix messed hunks in generic_setlease

I have noticed, that one hunk was lost and one duplicated during merging the fix-potential-oops-in-generic_setlease(-xxx) patches. One of the fixes is already in the hot-fixes, but the second one is still lost.

The returned pointer was not the one allocated, but some temporary used to scan through the inode's locks list. This caused and OOPS during Kamalesh's testing.

---

fs/locks.c +1 -1
index c0fe71a..c1198e3 100644
@@ -1423,7 +1418,7 @@ int generic_setlease(struct file *filp, 
 	locks_copy_lock(new_fl, lease);
 	locks_insert_lock(before, new_fl);
 
-	*flp = fl;
+	*flp = new_fl;
 	return 0;
 
 out:
#1 lore raw
Quoted 18 lines · On Tue, 25 Sep 2007 11:57:45 +0400 Pavel Emelyanov <[email protected]> wrote:

I have noticed, that one hunk was lost and one duplicated during merging the fix-potential-oops-in-generic_setlease(-xxx) patches. One of the fixes is already in the hot-fixes, but the second one is still lost.

The returned pointer was not the one allocated, but some temporary used to scan through the inode's locks list. This caused and OOPS during Kamalesh's testing.

---

fs/locks.c +0 -0
index c0fe71a..c1198e3 100644

fs/locks.c int generic_setlease(struct file *filp, · line 1424

Quoted 8 lines
fs/locks.c +1 -1
@@ -1423,7 +1418,7 @@ int generic_setlease(struct file *filp, 
 	locks_copy_lock(new_fl, lease);
 	locks_insert_lock(before, new_fl);
 
-	*flp = fl;
+	*flp = new_fl;
 	return 0;
 
 out:

argh, what a mess - there are way too many trees playing with fs/locks.c.

umm, I think this is not a mismerge and that the original patch
(http://lkml.org/lkml/2007/9/20/141) had this bug in it.

And I've just sent that buggy patch to Linus. Do you agree?

#2 lore raw
Quoted 27 lines · Andrew Morton
Quoted 25 lines · On Tue, 25 Sep 2007 11:57:45 +0400 Pavel Emelyanov <[email protected]> wrote:

I have noticed, that one hunk was lost and one duplicated during merging the fix-potential-oops-in-generic_setlease(-xxx) patches. One of the fixes is already in the hot-fixes, but the second one is still lost.

The returned pointer was not the one allocated, but some temporary used to scan through the inode's locks list. This caused and OOPS during Kamalesh's testing.

---

fs/locks.c +1 -1
index c0fe71a..c1198e3 100644
@@ -1423,7 +1418,7 @@ int generic_setlease(struct file *filp, 
 	locks_copy_lock(new_fl, lease);
 	locks_insert_lock(before, new_fl);
 
-	*flp = fl;
+	*flp = new_fl;
 	return 0;
 
Quoted 6 lines

fs/locks.c int generic_setlease(struct file *filp, · line 1424

Quoted 1 line
fs/locks.c +0 -0
 out:

argh, what a mess - there are way too many trees playing with fs/locks.c.

umm, I think this is not a mismerge and that the original patch
(http://lkml.org/lkml/2007/9/20/141) had this bug in it.

Indeed... :(

Quoted 1 line

And I've just sent that buggy patch to Linus. Do you agree?

Shame on me... Sorry :(

(going to the blackboard to write "I will check my patches twice before
sending them to Andrew" for 100 times)

#3 lore raw
In reply to Pavel Emelyanov
Quoted 19 lines · Pavel Emelyanov

I have noticed, that one hunk was lost and one duplicated during merging the fix-potential-oops-in-generic_setlease(-xxx) patches. One of the fixes is already in the hot-fixes, but the second one is still lost.

The returned pointer was not the one allocated, but some temporary used to scan through the inode's locks list. This caused and OOPS during Kamalesh's testing.

---

fs/locks.c +0 -0
index c0fe71a..c1198e3 100644

fs/locks.c int generic_setlease(struct file *filp, · line 1424

Quoted 8 lines
fs/locks.c +1 -1
@@ -1423,7 +1418,7 @@ int generic_setlease(struct file *filp, 
 	locks_copy_lock(new_fl, lease);
 	locks_insert_lock(before, new_fl);
 
-	*flp = fl;
+	*flp = new_fl;
 	return 0;
 
 out:

Hi Pavel,

I tested your patch and NULL pointer dereference is not triggered.

Signature · 4 lines
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.