patch-2.3.42 linux/ipc/shm.c
Next file: linux/kernel/exit.c
Previous file: linux/include/net/irda/wrapper.h
Back to the patch index
Back to the overall index
- Lines: 16
- Date:
Sat Jan 29 20:39:52 2000
- Orig file:
v2.3.41/linux/ipc/shm.c
- Orig date:
Fri Jan 28 15:09:09 2000
diff -u --recursive --new-file v2.3.41/linux/ipc/shm.c linux/ipc/shm.c
@@ -840,6 +840,15 @@
idx = (address - shmd->vm_start) >> PAGE_SHIFT;
idx += shmd->vm_pgoff;
+ /*
+ * A shared mapping past the last page of the file is an error
+ * and results in a SIGBUS, so logically a shared mapping past
+ * the end of a shared memory segment should result in SIGBUS
+ * as well.
+ */
+ if (idx >= shp->shm_npages) {
+ return NULL;
+ }
down(&shp->sem);
if(shp != shm_lock(shp->id))
BUG();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)