Skip to contentSkip to conversation

Missing up_read after get_user_pages in arch/i386/lib/usercopy.c?

PATCH Mark Frazer 2 participants 2 messages Dec 18, 2003

lore
Share & tools
lore
#0 lore raw

Just browsing users of get_user_pages today and noticed what might be a bug.

===== arch/i386/lib/usercopy.c 1.15 vs edited =====

arch/i386/lib/usercopy.c +3 -1
@@ -541,8 +541,10 @@
 				goto survive;
 			}
 
-			if (retval != 1)
+			if (retval != 1) {
+				up_read(&current->mm->mmap_sem);
 		       		break;
+			}
 
 			maddr = kmap_atomic(pg, KM_USER0);
 			memcpy(maddr + offset, from, len);
Signature · 1 line
Like most of life's problems, this one can be solved with bending. - Bender
#1 lore raw
Quoted 3 lines · Mark Frazer

Just browsing users of get_user_pages today and noticed what might be a bug.

Looks like it. It can only hit old 80386 machines (that code is disabled by any CPU with a i486 MMU or better), and even then only when somebody does something silly, but yeah, looks like a real bug.

Linus