[PATCH 2/8] sysvshm: report error on failure to reattach, avoid crash

Nathan Lynch ntl at pobox.com
Tue Sep 14 13:02:04 PDT 2010


If ipcshm_restore fails to look up the file object for the region
being restored, it should return the error to its caller and not
proceed to dereference the file pointer.

Signed-off-by: Nathan Lynch <ntl at pobox.com>
---
 ipc/shm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipc/shm.c b/ipc/shm.c
index eed4b9a..1ba9193 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -334,7 +334,7 @@ int ipcshm_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,
 
 	file = ckpt_obj_fetch(ctx, h->ino_objref, CKPT_OBJ_FILE);
 	if (IS_ERR(file))
-		PTR_ERR(file);
+		return PTR_ERR(file);
 
 	shmid = file->f_dentry->d_inode->i_ino;
 
-- 
1.7.2.2



More information about the Containers mailing list