propagate the ipc_obtain_object() errno from ipc_lock()
Cc: Chegu Vinod <chegu_vinod@hp.com>
Cc: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Emmanuel Benisty <benisty.e@gmail.com>
Cc: Jason Low <jason.low2@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michel Lespinasse <walken@google.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
*
* Look for an id in the ipc ids idr and lock the associated ipc object.
*
- * The ipc object is locked on exit.
+ * The ipc object is locked on successful exit.
*/
-
struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
{
struct kern_ipc_perm *out;
/* ipc_rmid() may have already freed the ID while ipc_lock
* was spinning: here verify that the structure is still valid
*/
- if (out->deleted)
- goto err0;
+ if (!out->deleted)
+ return out;
- return out;
-err0:
spin_unlock(&out->lock);
+ out = ERR_PTR(-EINVAL);
err1:
rcu_read_unlock();
- return ERR_PTR(-EINVAL);
+ return out;
}
/**