From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Matthew Wilcox <mawilcox@microsoft.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.13 10/27] radix-tree: must check __radix_tree_preload() return value
Date: Tue, 12 Sep 2017 09:59:50 -0700 [thread overview]
Message-ID: <20170912165309.428409776@linuxfoundation.org> (raw)
In-Reply-To: <20170912165308.904472972@linuxfoundation.org>
4.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
commit bc9ae2247ac92fd4d962507bafa3afffff6660ff upstream.
__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: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree")
Fixes: 7ad3d4d85c7a ("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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
lib/radix-tree.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -463,7 +463,7 @@ radix_tree_node_free(struct radix_tree_n
* To make use of this facility, the radix tree must be initialised without
* __GFP_DIRECT_RECLAIM being passed to INIT_RADIX_TREE().
*/
-static int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
+static __must_check int __radix_tree_preload(gfp_t gfp_mask, unsigned nr)
{
struct radix_tree_preload *rtp;
struct radix_tree_node *node;
@@ -2103,7 +2103,8 @@ EXPORT_SYMBOL(radix_tree_tagged);
*/
void idr_preload(gfp_t gfp_mask)
{
- __radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE);
+ if (__radix_tree_preload(gfp_mask, IDR_PRELOAD_SIZE))
+ preempt_disable();
}
EXPORT_SYMBOL(idr_preload);
@@ -2117,13 +2118,13 @@ EXPORT_SYMBOL(idr_preload);
*/
int ida_pre_get(struct ida *ida, gfp_t gfp)
{
- __radix_tree_preload(gfp, IDA_PRELOAD_SIZE);
/*
* The IDA API has no preload_end() equivalent. Instead,
* ida_get_new() can return -EAGAIN, prompting the caller
* to return to the ida_pre_get() step.
*/
- preempt_enable();
+ if (!__radix_tree_preload(gfp, IDA_PRELOAD_SIZE))
+ preempt_enable();
if (!this_cpu_read(ida_bitmap)) {
struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp);
next prev parent reply other threads:[~2017-09-12 17:01 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 16:59 [PATCH 4.13 00/27] 4.13.2-stable review Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 02/27] mtd: nand: hynix: add support for 20nm NAND chips Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 03/27] mtd: nand: mxc: Fix mxc_v1 ooblayout Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 04/27] mtd: nand: qcom: fix read failure without complete bootchain Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 05/27] mtd: nand: qcom: fix config error for BCH Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 06/27] nvme-fabrics: generate spec-compliant UUID NQNs Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 07/27] btrfs: resume qgroup rescan on rw remount Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 08/27] rtlwifi: btcoexist: Fix breakage of ant_sel for rtl8723be Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 09/27] rtlwifi: btcoexist: Fix antenna selection code Greg Kroah-Hartman
2017-09-12 16:59 ` Greg Kroah-Hartman [this message]
2017-09-12 16:59 ` [PATCH 4.13 11/27] brcmfmac: feature check for multi-scheduled scan fails on bcm4345 devices Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 12/27] kselftests: timers: leap-a-day: Change default arguments to help test runs Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 13/27] selftests: timers: Fix run_destructive_tests target to handle skipped tests Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 14/27] selftests/x86/fsgsbase: Test selectors 1, 2, and 3 Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 15/27] mm: kvfree the swap cluster info if the swap file is unsatisfactory Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 16/27] mm/swapfile.c: fix swapon frontswap_map memory leak on error Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 17/27] mm/sparse.c: fix typo in online_mem_sections Greg Kroah-Hartman
2017-09-12 16:59 ` [PATCH 4.13 18/27] mm/memory.c: fix mem_cgroup_oom_disable() call missing Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 20/27] Revert "firmware: add sanity check on shutdown/suspend" Greg Kroah-Hartman
2017-09-12 17:20 ` Luis R. Rodriguez
2017-09-13 0:47 ` Greg Kroah-Hartman
2017-09-13 1:22 ` Luis R. Rodriguez
2017-09-13 1:40 ` Greg Kroah-Hartman
2017-09-13 4:11 ` Linus Torvalds
2017-09-13 18:38 ` Luis R. Rodriguez
2017-09-13 19:30 ` Linus Torvalds
2017-09-13 21:44 ` Luis R. Rodriguez
2017-09-12 17:00 ` [PATCH 4.13 21/27] rt2800: fix TX_PIN_CFG setting for non MT7620 chips Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 22/27] Bluetooth: Properly check L2CAP config option output buffer length Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 23/27] ARM64: dts: marvell: armada-37xx: Fix GIC maintenance interrupt Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 24/27] ARM: 8692/1: mm: abort uaccess retries upon fatal signal Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 25/27] NFS: Fix 2 use after free issues in the I/O code Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 26/27] NFS: Sync the correct byte range during synchronous writes Greg Kroah-Hartman
2017-09-12 17:00 ` [PATCH 4.13 27/27] NFSv4: Fix up mirror allocation Greg Kroah-Hartman
2017-09-13 0:13 ` [PATCH 4.13 00/27] 4.13.2-stable review Shuah Khan
2017-09-13 0:57 ` Greg Kroah-Hartman
[not found] ` <59b8666e.e2a9df0a.378a2.e18c@mx.google.com>
2017-09-13 1:03 ` Greg Kroah-Hartman
2017-09-13 22:16 ` Kevin Hilman
2017-09-13 14:35 ` Guenter Roeck
2017-09-13 19:01 ` Greg Kroah-Hartman
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=20170912165309.428409776@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=edumazet@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mawilcox@microsoft.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.