Skip to contentSkip to conversation

shmdt fix

PATCH Paul Larson 2 participants 2 messages Mar 15, 2002 – Mar 19, 2002

lore
Share & tools
lore
#0 lore raw

Marcelo, in 2.4.19-pre1 the changelog said that the shmdt fix was included, but it is still failing the LTP testcase that found this problem. There is a small, but important set of {}'s that got missed, so it is still always returning 0 even if there is nothing to detach. The attached diff will clean this up on 2.4.19-pre3.

Thanks,
Paul Larson

ipc/shm.c +2 -1
diff -Naur linux/ipc/shm.c linux-shmdt/ipc/shm.c
@@ -678,9 +678,10 @@
 	for (shmd = mm->mmap; shmd; shmd = shmdnext) {
 		shmdnext = shmd->vm_next;
 		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);
 			retval = 0;
+		}
 	}
 	up_write(&mm->mmap_sem);
 	return retval;
#1 lore raw

Paul,

This patch is already included in my latest tree.

Thanks!

Quoted 27 lines · Paul Larson

Marcelo, in 2.4.19-pre1 the changelog said that the shmdt fix was included, but it is still failing the LTP testcase that found this problem. There is a small, but important set of {}'s that got missed, so it is still always returning 0 even if there is nothing to detach. The attached diff will clean this up on 2.4.19-pre3.

Thanks,
Paul Larson

diff -Naur linux/ipc/shm.c linux-shmdt/ipc/shm.c

ipc/shm.c +2 -1
@@ -678,9 +678,10 @@
 	for (shmd = mm->mmap; shmd; shmd = shmdnext) {
 		shmdnext = shmd->vm_next;
 		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);
 			retval = 0;
+		}
 	}
 	up_write(&mm->mmap_sem);
 	return retval;