summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/net/af_unix.h3
-rw-r--r--net/unix/garbage.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index f22ab1a7b6ba..c1d17aad02f7 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -72,6 +72,9 @@ enum unix_socket_lock_class {
U_LOCK_NORMAL,
U_LOCK_SECOND, /* for double locking, see unix_state_double_lock(). */
U_LOCK_DIAG, /* used while dumping icons, see sk_diag_dump_icons(). */
+ U_LOCK_GC_LISTENER, /* used for listening socket while determining gc
+ * candidates to close a small race window.
+ */
};
static inline void unix_state_lock_nested(struct sock *sk,
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index a3a49110fe06..fa2b740a4cbc 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -264,7 +264,7 @@ void unix_gc(void)
__set_bit(UNIX_GC_MAYBE_CYCLE, &u->gc_flags);
if (sk->sk_state == TCP_LISTEN) {
- unix_state_lock(sk);
+ unix_state_lock_nested(sk, U_LOCK_GC_LISTENER);
unix_state_unlock(sk);
}
}