Skip to contentSkip to conversation

af_unix: Reject SIOCATMARK on non-stream sockets

PATCH Applied Alexander Martyniuk 2 participants 2 messages Jun 24 – Jun 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 af_unix: Reject SIOCATMARK on non-stream sockets

From: Jiexun Wang <[email protected]>

commit d119775f2bad827edc28071c061fdd4a91f889a5 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.

---
Backport fix for CVE-2026-52928

 net/unix/af_unix.c | 3 +++
 1 file changed, 3 insertions(+)
net/unix/af_unix.c +3 -0
index 32892a40d139..8bd78cad69e7 100644
@@ -3139,6 +3139,9 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 			struct sk_buff *skb;
 			int answ = 0;
 
+			if (sk->sk_type != SOCK_STREAM)
+				return -EOPNOTSUPP;
+
 			skb = skb_peek(&sk->sk_receive_queue);
 			if (skb && skb == READ_ONCE(unix_sk(sk)->oob_skb))
 				answ = 1;
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 4 lines

[PATCH 5.15/6.1/6.6] af_unix: Reject SIOCATMARK on non-stream sockets

Backport fix for CVE-2026-52928. Reject SIOCATMARK in unix_ioctl() for non-stream sockets.

Queued for 6.6, 6.1 and 5.15, thanks!

--
Thanks,
Sasha