public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+006987d1be3586e13555@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [arm-msm?] [net?] memory leak in radix_tree_insert
Date: Sat, 09 Dec 2023 22:06:59 -0800	[thread overview]
Message-ID: <00000000000013a049060c21a08b@google.com> (raw)
In-Reply-To: <000000000000bfba3a060bf4ffcf@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [arm-msm?] [net?] memory leak in radix_tree_insert
Author: eadavis@qq.com

please test memory leak in radix_tree_insert

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 33cc938e65a9

diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index eae67015ce51..cc3e9fc7bae0 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -254,6 +254,7 @@ unsigned int radix_tree_gang_lookup_tag_slot(const struct radix_tree_root *,
 		void __rcu ***results, unsigned long first_index,
 		unsigned int max_items, unsigned int tag);
 int radix_tree_tagged(const struct radix_tree_root *, unsigned int tag);
+unsigned long radix_tree_maxindex(const struct radix_tree_root *root);
 
 static inline void radix_tree_preload_end(void)
 {
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index b98e9f2c24ac..a89df8afa510 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -404,6 +404,18 @@ static unsigned radix_tree_load_root(const struct radix_tree_root *root,
 	return 0;
 }
 
+unsigned long radix_tree_maxindex(const struct radix_tree_root *root)
+{
+	struct radix_tree_node *node = rcu_dereference_raw(root->xa_head);
+
+	if (likely(radix_tree_is_internal_node(node))) {
+		node = entry_to_node(node);
+		return node_maxindex(node);
+	}
+
+	return 0;
+}
+
 /*
  *	Extend a radix tree so it can store key @index.
  */
diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
index 41ece61eb57a..abdae567a370 100644
--- a/net/qrtr/af_qrtr.c
+++ b/net/qrtr/af_qrtr.c
@@ -344,6 +344,12 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 	struct qrtr_hdr_v1 *hdr;
 	size_t len = skb->len;
 	int rc, confirm_rx;
+	unsigned long maxidx;
+
+	if (to->sq_node == QRTR_NODE_BCAST) {
+		maxidx = radix_tree_maxindex(&node->qrtr_tx_flow);
+		to->sq_node = maxidx + 1;
+	}
 
 	confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);
 	if (confirm_rx < 0) {


  parent reply	other threads:[~2023-12-10  6:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  0:52 [syzbot] [arm-msm?] [net?] memory leak in radix_tree_insert (2) syzbot
2023-12-08  4:13 ` [syzbot] [arm-msm?] [net?] memory leak in radix_tree_insert syzbot
2023-12-08  5:56 ` syzbot
2023-12-08  6:59 ` syzbot
2023-12-08  7:44 ` syzbot
2023-12-08  9:45 ` syzbot
2023-12-09  4:40 ` syzbot
2023-12-09  6:52 ` syzbot
2023-12-09  6:53 ` syzbot
2023-12-10  1:04 ` syzbot
2023-12-10  3:52 ` syzbot
2023-12-10  4:30 ` syzbot
2023-12-10  5:14 ` syzbot
2023-12-10  6:06 ` syzbot [this message]
2023-12-10  6:58 ` syzbot
2023-12-11  4:24 ` syzbot
2023-12-11  5:15 ` syzbot
2023-12-11  9:48 ` [PATCH] radix-tree: fix " Lizhi Xu
2023-12-11 23:16   ` kernel test robot
2023-12-13  3:25     ` Lizhi Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00000000000013a049060c21a08b@google.com \
    --to=syzbot+006987d1be3586e13555@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox