Skip to content

Commit 0d7e723

Browse files
JiexunWanggregkh
authored andcommitted
af_unix: Reject SIOCATMARK on non-stream sockets
commit d119775 upstream. SIOCATMARK reports whether the receive queue is at the urgent mark for MSG_OOB. In AF_UNIX, MSG_OOB is supported only for SOCK_STREAM sockets. SOCK_DGRAM and SOCK_SEQPACKET reject MSG_OOB in sendmsg() and recvmsg(), so they should not support SIOCATMARK either. Return -EOPNOTSUPP for non-stream sockets before checking the receive queue. Fixes: 314001f ("af_unix: Add OOB support") Cc: stable@kernel.org Reported-by: Yuan Tan <yuantan098@gmail.com> Reported-by: Yifan Wu <yifanwucs@gmail.com> Reported-by: Juefei Pu <tomapufckgml@gmail.com> Reported-by: Xin Liu <bird@lzu.edu.cn> Suggested-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Jiexun Wang <wangjiexun2025@gmail.com> Signed-off-by: Ren Wei <n05ec@lzu.edu.cn> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260506140825.2987635-1-n05ec@lzu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d6c7f32 commit 0d7e723

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/unix/af_unix.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,9 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state,
28072807
goto out;
28082808
}
28092809

2810+
if (sk->sk_type != SOCK_STREAM)
2811+
return -EOPNOTSUPP;
2812+
28102813
mutex_lock(&u->iolock);
28112814
goto redo;
28122815
unlock:

0 commit comments

Comments
 (0)