<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/lib/generic-radix-tree.c, branch v5.15.208</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.208'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-09-12T09:07:50+00:00</updated>
<entry>
<title>lib/generic-radix-tree.c: Fix rare race in __genradix_ptr_alloc()</title>
<updated>2024-09-12T09:07:50+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2024-08-11T01:04:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ad5ee9feebc2eb8cfc76ed74a2d6e55343b0e169'/>
<id>urn:sha1:ad5ee9feebc2eb8cfc76ed74a2d6e55343b0e169</id>
<content type='text'>
[ Upstream commit b2f11c6f3e1fc60742673b8675c95b78447f3dae ]

If we need to increase the tree depth, allocate a new node, and then
race with another thread that increased the tree depth before us, we'll
still have a preallocated node that might be used later.

If we then use that node for a new non-root node, it'll still have a
pointer to the old root instead of being zeroed - fix this by zeroing it
in the cmpxchg failure path.

Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>lib/generic-radix-tree.c: add kmemleak annotations</title>
<updated>2019-10-14T22:04:00+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-14T21:11:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3c52b0af059e11a063970aed1ad143b9284a79c7'/>
<id>urn:sha1:3c52b0af059e11a063970aed1ad143b9284a79c7</id>
<content type='text'>
Kmemleak is falsely reporting a leak of the slab allocation in
sctp_stream_init_ext():

  BUG: memory leak
  unreferenced object 0xffff8881114f5d80 (size 96):
   comm "syz-executor934", pid 7160, jiffies 4294993058 (age 31.950s)
   hex dump (first 32 bytes):
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
   backtrace:
     [&lt;00000000ce7a1326&gt;] kmemleak_alloc_recursive  include/linux/kmemleak.h:55 [inline]
     [&lt;00000000ce7a1326&gt;] slab_post_alloc_hook mm/slab.h:439 [inline]
     [&lt;00000000ce7a1326&gt;] slab_alloc mm/slab.c:3326 [inline]
     [&lt;00000000ce7a1326&gt;] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553
     [&lt;000000007abb7ac9&gt;] kmalloc include/linux/slab.h:547 [inline]
     [&lt;000000007abb7ac9&gt;] kzalloc include/linux/slab.h:742 [inline]
     [&lt;000000007abb7ac9&gt;] sctp_stream_init_ext+0x2b/0xa0  net/sctp/stream.c:157
     [&lt;0000000048ecb9c1&gt;] sctp_sendmsg_to_asoc+0x946/0xa00  net/sctp/socket.c:1882
     [&lt;000000004483ca2b&gt;] sctp_sendmsg+0x2a8/0x990 net/sctp/socket.c:2102
     [...]

But it's freed later.  Kmemleak misses the allocation because its
pointer is stored in the generic radix tree sctp_stream::out, and the
generic radix tree uses raw pages which aren't tracked by kmemleak.

Fix this by adding the kmemleak hooks to the generic radix tree code.

Link: http://lkml.kernel.org/r/20191004065039.727564-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reported-by: &lt;syzbot+7f3b6b106be8dcdcdeec@syzkaller.appspotmail.com&gt;
Reviewed-by: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Reviewed-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Cc: Xin Long &lt;lucien.xin@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/generic-radix-tree.c: make 2 functions static inline</title>
<updated>2019-09-26T00:51:39+00:00</updated>
<author>
<name>Valdis Kletnieks</name>
<email>valdis.kletnieks@vt.edu</email>
</author>
<published>2019-09-25T23:46:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e3f4faa42095cacceeb33c68fda647a8e6d48a90'/>
<id>urn:sha1:e3f4faa42095cacceeb33c68fda647a8e6d48a90</id>
<content type='text'>
When building with W=1, we get some warnings:

l  CC      lib/generic-radix-tree.o
lib/generic-radix-tree.c:39:10: warning: no previous prototype for 'genradix_root_to_depth' [-Wmissing-prototypes]
   39 | unsigned genradix_root_to_depth(struct genradix_root *r)
      |          ^~~~~~~~~~~~~~~~~~~~~~
lib/generic-radix-tree.c:44:23: warning: no previous prototype for 'genradix_root_to_node' [-Wmissing-prototypes]
   44 | struct genradix_node *genradix_root_to_node(struct genradix_root *r)
      |                       ^~~~~~~~~~~~~~~~~~~~~

They're not used anywhere else, so make them static inline.

Link: http://lkml.kernel.org/r/46923.1565236485@turing-police
Signed-off-by: Valdis Kletnieks &lt;valdis.kletnieks@vt.edu&gt;
Cc: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>generic radix trees</title>
<updated>2019-03-12T17:04:02+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@gmail.com</email>
</author>
<published>2019-03-12T06:31:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ba20ba2e3743bac786dff777954c11930256075e'/>
<id>urn:sha1:ba20ba2e3743bac786dff777954c11930256075e</id>
<content type='text'>
Very simple radix tree implementation that supports storing arbitrary
size entries, up to PAGE_SIZE - upcoming patches will convert existing
flex_array users to genradixes.  The new genradix code has a much
simpler API and implementation, and doesn't have a hard limit on the
number of elements like flex_array does.

Link: http://lkml.kernel.org/r/20181217131929.11727-5-kent.overstreet@gmail.com
Signed-off-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Dave Hansen &lt;dave.hansen@intel.com&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Cc: Marcelo Ricardo Leitner &lt;marcelo.leitner@gmail.com&gt;
Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: Pravin B Shelar &lt;pshelar@ovn.org&gt;
Cc: Shaohua Li &lt;shli@kernel.org&gt;
Cc: Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Cc: Vlad Yasevich &lt;vyasevich@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
