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-next>] [day] [month] [year] [list]
Message-ID: <20240205170117.250866-1-dmantipov@yandex.ru>
Date: Mon,  5 Feb 2024 20:01:11 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
Cc: Xin Long <lucien.xin@...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 memory leak in sctp_chunk_destroy()

In case of GSO, per-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), consume 'head_skb' (i.e. beginning of a fraglist) instead.

Reported-by: syzbot+8bb053b5d63595ab47db@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=0d8351bbe54fd04a492c2daab0164138db008042
Signed-off-by: Dmitry Antipov <dmantipov@...dex.ru>
---
 net/sctp/sm_make_chunk.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index f80208edd6a5..30fe34743009 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1500,7 +1500,10 @@ static void sctp_chunk_destroy(struct sctp_chunk *chunk)
 	BUG_ON(!list_empty(&chunk->list));
 	list_del_init(&chunk->transmitted_list);
 
-	consume_skb(chunk->skb);
+	/* In case of GSO, 'skb' may be a pointer to fraglist entry.
+	 * Consume the read head if so.
+	 */
+	consume_skb(chunk->head_skb ? chunk->head_skb : chunk->skb);
 	consume_skb(chunk->auth_chunk);
 
 	SCTP_DBG_OBJCNT_DEC(chunk);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ