]> git.baikalelectronics.ru Git - kernel.git/commit
radix-tree: must check __radix_tree_preload() return value
authorEric Dumazet <edumazet@google.com>
Fri, 8 Sep 2017 23:15:54 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 9 Sep 2017 01:26:49 +0000 (18:26 -0700)
commit81d6477d4fe4bc2dd965a452d7fa5fc625e6d742
tree56c87a7b15fc0beb1f51e57167840e1d0fd3c917
parentb9cab45b2c11e8f7094f64b4d9c38e00a18068eb
radix-tree: must check __radix_tree_preload() return value

__radix_tree_preload() only disables preemption if no error is returned.

So we really need to make sure callers always check the return value.

idr_preload() contract is to always disable preemption, so we need
to add a missing preempt_disable() if an error happened.

Similarly, ida_pre_get() only needs to call preempt_enable() in the
case no error happened.

Link: http://lkml.kernel.org/r/1504637190.15310.62.camel@edumazet-glaptop3.roam.corp.google.com
Fixes: 78a16fc0fc52 ("Reimplement IDR and IDA using the radix tree")
Fixes: fc349567b7bb ("ida: Move ida_bitmap to a percpu variable")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: <stable@vger.kernel.org> [4.11+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/radix-tree.c