Skip to content

Commit bace4b4

Browse files
q2venkuba-moo
authored andcommitted
af_unix: Set drop reason in unix_stream_read_skb().
unix_stream_read_skb() is called when BPF SOCKMAP reads some data from a socket in the map. SOCKMAP does not support MSG_OOB, and reading OOB results in a drop. Let's set drop reasons respectively. * SOCKET_CLOSE : the socket in SOCKMAP was close()d * UNIX_SKIP_OOB : OOB was read from the socket in SOCKMAP Signed-off-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 533643b commit bace4b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/unix/af_unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,7 @@ static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
27242724

27252725
if (sock_flag(sk, SOCK_DEAD)) {
27262726
unix_state_unlock(sk);
2727-
kfree_skb(skb);
2727+
kfree_skb_reason(skb, SKB_DROP_REASON_SOCKET_CLOSE);
27282728
return -ECONNRESET;
27292729
}
27302730

@@ -2738,7 +2738,7 @@ static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
27382738
unix_state_unlock(sk);
27392739

27402740
if (drop) {
2741-
kfree_skb(skb);
2741+
kfree_skb_reason(skb, SKB_DROP_REASON_UNIX_SKIP_OOB);
27422742
return -EAGAIN;
27432743
}
27442744
}

0 commit comments

Comments
 (0)