The patch titled Subject: ipc,sem: prevent releasing RCU read lock twice in semctl_main has been added to the -mm tree. Its filename is ipcsem-do-not-hold-ipc-lock-more-than-necessary-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Sasha Levin <sasha.levin@xxxxxxxxxx> Subject: ipc,sem: prevent releasing RCU read lock twice in semctl_main We will release RCU read lock twice if the sem id passed from userspace is not within the legal range in semctl_main. Reviewed-by: Rik van Riel <riel@xxxxxxxxxx> Reviewed-by: Davidlohr Bueso <davidlohr.bueso@xxxxxx> Signed-off-by: Sasha Levin <sasha.levin@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- ipc/sem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN ipc/sem.c~ipcsem-do-not-hold-ipc-lock-more-than-necessary-fix ipc/sem.c --- a/ipc/sem.c~ipcsem-do-not-hold-ipc-lock-more-than-necessary-fix +++ a/ipc/sem.c @@ -1098,8 +1098,10 @@ static int semctl_main(struct ipc_namesp /* GETVAL, GETPID, GETNCTN, GETZCNT: fall-through */ } err = -EINVAL; - if(semnum < 0 || semnum >= nsems) - goto out_unlock; + if(semnum < 0 || semnum >= nsems) { + rcu_read_unlock(); + goto out_wakeup; + } spin_lock(&sma->sem_perm.lock); curr = &sma->sem_base[semnum]; _ Patches currently in -mm which might be from sasha.levin@xxxxxxxxxx are linux-next.patch watchdog-trigger-all-cpu-backtrace-when-locked-up-and-going-to-panic.patch ipcsem-do-not-hold-ipc-lock-more-than-necessary-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html