Messages in this thread | | | Date | Sat, 30 Mar 2013 21:30:16 -0400 | From | Rik van Riel <> | Subject | Re: [PATCH -mm -next] ipc,sem: untangle RCU locking with find_alloc_undo |
| |
On 03/30/2013 09:35 AM, Sasha Levin wrote:
> I'm thinking that the solution is as simple as:
Your patch is absolutely correct. All it needs now is your signed-off-by, so Andrew can merge it into -mm :)
Reviewed-by: Rik van Riel <riel@redhat.com>
> diff --git a/ipc/sem.c b/ipc/sem.c > index 6e109ef..ac36671 100644 > --- a/ipc/sem.c > +++ b/ipc/sem.c > @@ -1333,8 +1333,10 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, > /* 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; > + } > > sem_lock(sma, NULL, -1); > curr = &sma->sem_base[semnum]; > > But I'm not 100% sure if I don't mess up anything else.
I checked the surrounding code, it all looks fine.
-- All rights reversed.
| |