Commit 531b536d authored by Dave Jones's avatar Dave Jones

[PATCH] wrong return codes in ipc shm

We always returned success even when we had no ->vm_ops
parent 4d148125
...@@ -674,16 +674,19 @@ asmlinkage long sys_shmdt (char *shmaddr) ...@@ -674,16 +674,19 @@ asmlinkage long sys_shmdt (char *shmaddr)
{ {
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
struct vm_area_struct *shmd, *shmdnext; struct vm_area_struct *shmd, *shmdnext;
int retval = -EINVAL;
down_write(&mm->mmap_sem); down_write(&mm->mmap_sem);
for (shmd = mm->mmap; shmd; shmd = shmdnext) { for (shmd = mm->mmap; shmd; shmd = shmdnext) {
shmdnext = shmd->vm_next; shmdnext = shmd->vm_next;
if (shmd->vm_ops == &shm_vm_ops if (shmd->vm_ops == &shm_vm_ops
&& shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) {
do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start); do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start);
retval = 0;
}
} }
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
return 0; return retval;
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment