aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/garbage.c
diff options
context:
space:
mode:
authorKuniyuki Iwashima <[email protected]>2024-01-23 17:08:54 +0000
committerJakub Kicinski <[email protected]>2024-01-27 04:34:25 +0000
commit5b17307bd0789edea0675d524a2b277b93bbde62 (patch)
tree12578ed97ff17461f11530773e48c2ab9ecff385 /net/unix/garbage.c
parentaf_unix: Do not use atomic ops for unix_sk(sk)->inflight. (diff)
downloadkernel-5b17307bd0789edea0675d524a2b277b93bbde62.tar.gz
kernel-5b17307bd0789edea0675d524a2b277b93bbde62.zip
af_unix: Return struct unix_sock from unix_get_socket().
Currently, unix_get_socket() returns struct sock, but after calling it, we always cast it to unix_sk(). Let's return struct unix_sock from unix_get_socket(). Signed-off-by: Kuniyuki Iwashima <[email protected]> Acked-by: Pavel Begunkov <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/unix/garbage.c')
-rw-r--r--net/unix/garbage.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 051f96a3ab02..d5ef46a75f1f 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -105,20 +105,15 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
while (nfd--) {
/* Get the socket the fd matches if it indeed does so */
- struct sock *sk = unix_get_socket(*fp++);
+ struct unix_sock *u = unix_get_socket(*fp++);
- if (sk) {
- struct unix_sock *u = unix_sk(sk);
+ /* Ignore non-candidates, they could have been added
+ * to the queues after starting the garbage collection
+ */
+ if (u && test_bit(UNIX_GC_CANDIDATE, &u->gc_flags)) {
+ hit = true;
- /* Ignore non-candidates, they could
- * have been added to the queues after
- * starting the garbage collection
- */
- if (test_bit(UNIX_GC_CANDIDATE, &u->gc_flags)) {
- hit = true;
-
- func(u);
- }
+ func(u);
}
}
if (hit && hitlist != NULL) {