lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue,  6 Feb 2024 12:26:17 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Xin Long <lucien.xin@...il.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
	linux-sctp@...r.kernel.org,
	netdev@...r.kernel.org,
	lvc-project@...uxtesting.org,
	Dmitry Antipov <dmantipov@...dex.ru>,
	syzbot+8bb053b5d63595ab47db@...kaller.appspotmail.com
Subject: [PATCH] net: sctp: fix skb leak in sctp_inq_free()

In case of GSO, 'chunk->skb' pointer may point to an entry from
fraglist created in 'sctp_packet_gso_append()'. To avoid freeing
random fraglist entry (and so undefined behavior and/or memory
leak), ensure that 'chunk->skb' is set to 'chunk->head_skb'
(i.e. fraglist head) before calling 'sctp_chunk_free()'.

Reported-by: syzbot+8bb053b5d63595ab47db@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=0d8351bbe54fd04a492c2daab0164138db008042
Fixes: 90017accff61 ("sctp: Add GSO support")
Suggested-by: Xin Long <lucien.xin@...il.com>
Signed-off-by: Dmitry Antipov <dmantipov@...dex.ru>
---
 net/sctp/inqueue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 7182c5a450fb..dda5e1ad9cac 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -52,8 +52,11 @@ void sctp_inq_free(struct sctp_inq *queue)
 	/* If there is a packet which is currently being worked on,
 	 * free it as well.
 	 */
-	if (queue->in_progress) {
-		sctp_chunk_free(queue->in_progress);
+	chunk = queue->in_progress;
+	if (chunk) {
+		if (chunk->head_skb)
+			chunk->skb = chunk->head_skb;
+		sctp_chunk_free(chunk);
 		queue->in_progress = NULL;
 	}
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ