This is a note to let you know that I've just added the patch titled ipc,shm: cleanup do_shmat pasta to the 3.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ipc-shm-cleanup-do_shmat-pasta.patch and it can be found in the queue-3.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From f42569b1388b1408b574a5e93a23a663647d4181 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso <davidlohr.bueso@xxxxxx> Date: Wed, 11 Sep 2013 14:26:22 -0700 Subject: ipc,shm: cleanup do_shmat pasta From: Davidlohr Bueso <davidlohr.bueso@xxxxxx> commit f42569b1388b1408b574a5e93a23a663647d4181 upstream. Clean up some of the messy do_shmat() spaghetti code, getting rid of out_free and out_put_dentry labels. This makes shortening the critical region of this function in the next patch a little easier to do and read. Signed-off-by: Davidlohr Bueso <davidlohr.bueso@xxxxxx> Tested-by: Sedat Dilek <sedat.dilek@xxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Mike Galbraith <efault@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- ipc/shm.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) --- a/ipc/shm.c +++ b/ipc/shm.c @@ -1115,16 +1115,21 @@ long do_shmat(int shmid, char __user *sh err = -ENOMEM; sfd = kzalloc(sizeof(*sfd), GFP_KERNEL); - if (!sfd) - goto out_put_dentry; + if (!sfd) { + path_put(&path); + goto out_nattch; + } file = alloc_file(&path, f_mode, is_file_hugepages(shp->shm_file) ? &shm_file_operations_huge : &shm_file_operations); err = PTR_ERR(file); - if (IS_ERR(file)) - goto out_free; + if (IS_ERR(file)) { + kfree(sfd); + path_put(&path); + goto out_nattch; + } file->private_data = sfd; file->f_mapping = shp->shm_file->f_mapping; @@ -1150,7 +1155,7 @@ long do_shmat(int shmid, char __user *sh addr > current->mm->start_stack - size - PAGE_SIZE * 5) goto invalid; } - + addr = do_mmap_pgoff(file, addr, size, prot, flags, 0, &populate); *raddr = addr; err = 0; @@ -1174,19 +1179,12 @@ out_nattch: else shm_unlock(shp); up_write(&shm_ids(ns).rw_mutex); - -out: return err; out_unlock: shm_unlock(shp); - goto out; - -out_free: - kfree(sfd); -out_put_dentry: - path_put(&path); - goto out_nattch; +out: + return err; } SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg) Patches currently in stable-queue which might be from davidlohr.bueso@xxxxxx are queue-3.11/ipc-shm-shorten-critical-region-in-shmctl_down.patch queue-3.11/ipc-shm-introduce-lockless-functions-to-obtain-the-ipc-object.patch queue-3.11/ipc-shm-shorten-critical-region-for-shmat.patch queue-3.11/ipc-shm-shorten-critical-region-for-shmctl.patch queue-3.11/ipc-shm-introduce-shmctl_nolock.patch queue-3.11/ipc-drop-ipcctl_pre_down.patch queue-3.11/ipc-shm-cleanup-do_shmat-pasta.patch queue-3.11/ipc-shm-make-shmctl_nolock-lockless.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html