Skip to content
Commit 5820f140 authored by Jann Horn's avatar Jann Horn Committed by Eric W. Biederman
Browse files

userns: move user access out of the mutex

The old code would hold the userns_state_mutex indefinitely if
memdup_user_nul stalled due to e.g. a userfault region. Prevent that by
moving the memdup_user_nul in front of the mutex_lock().

Note: This changes the error precedence of invalid buf/count/*ppos vs
map already written / capabilities missing.

Fixes: 22d917d8

 ("userns: Rework the user_namespace adding uid/gid...")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJann Horn <jannh@google.com>
Acked-by: default avatarChristian Brauner <christian@brauner.io>
Acked-by: default avatarSerge Hallyn <serge@hallyn.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 355139a8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment