Skip to contentSkip to conversation

kernel bug in mmap

Linux-ia64 Richard Hirst 2 participants 2 messages Aug 31, 2001

lore
Share & tools
lore
#0 lore raw

Hi,
Attempts to mmap an empty file result in the file being left busy,
such that the file system cannot be unmounted. Fix below.

Richard

arch/ia64/kernel/sys_ia64.c renamed from arch/ia64/kernel/sys_ia64.cold +2 -2
@@ -194,7 +194,7 @@
 	 */
 	len = PAGE_ALIGN(len);
 	if (len = 0)
-		return addr;
+		goto out;
 
 	/* don't permit mappings into unmapped space or the virtual page table of a region: */
 	roff = rgn_offset(addr);
@@ -208,7 +208,7 @@
 	down_write(&current->mm->mmap_sem);
 	addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
 	up_write(&current->mm->mmap_sem);
-
+out:
 	if (file)
 		fput(file);
 	return addr;
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Richard Hirst

Richard> Hi, Attempts to mmap an empty file result in the file being Richard> left busy, such that the file system cannot be unmounted. Richard> Fix below.

Thanks for the patch. There seem to be several other error conditions in do_mmap2() in which the fput() is skipped. I'll fix those, too.

Thanks,

	--david