BACKPORT: seccomp: Replace BUG(!spin_is_locked()) with assert_spin_lock

Current upstream kernel hangs with mips and powerpc targets in
uniprocessor mode if SECCOMP is configured.

Bisect points to commit dbd952127d11 ("seccomp: introduce writer locking").
Turns out that code such as
can not be used in uniprocessor mode because spin_is_locked() always
returns false in this configuration, and that assert_spin_locked()
exists for that very purpose and must be used instead.

Fixes: dbd952127d11 ("seccomp: introduce writer locking")
Cc: Kees Cook <>
Signed-off-by: Guenter Roeck <>
Signed-off-by: Kees Cook <>

Bug: 28020023
Patchset: seccomp

(cherry picked from kernel/msm commit 13586040a7dbea50de47e75ef5cf5516ae5ee343)
Signed-off-by: Kees Cook <>
Change-Id: Ida92996dcaf2828084bdcff43a5e1c7df5edf475
2 files changed