]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
misc: tegra-profiler: rd_alloc
authorShu Zhong <shuz@nvidia.com>
Tue, 1 Jul 2014 17:25:57 +0000 (10:25 -0700)
committerDhiren Parmar <dparmar@nvidia.com>
Tue, 12 Aug 2014 12:48:53 +0000 (05:48 -0700)
quadd_unwind_start calls rd_alloc while holding a spinlock.
This is dangerous because rd_alloc allocates memory with
the GFP_KERNEL flag. This fix simply moves rd_alloc outside
the critical section.

Bug 1529894

Change-Id: I284e72d2fdd9089428d75f3c3efb79513a897b7e
Signed-off-by: Shu Zhong <shuz@nvidia.com>
Reviewed-on: http://git-master/r/433264
(cherry picked from commit e29a862f449b3f1831410162c4360041438017dc)
Reviewed-on: http://git-master/r/454479
Reviewed-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Maxim Morin <mmorin@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>
drivers/misc/tegra-profiler/eh_unwind.c

index dcbda98c0db0605f2c0bc179a8166b207f7835e7..60ae9c440adadac765b2a54f05abab0ec56215d2 100644 (file)
@@ -1125,6 +1125,7 @@ quadd_is_ex_entry_exist(struct pt_regs *regs,
 int quadd_unwind_start(struct task_struct *task)
 {
        struct regions_data *rd, *rd_old;
+       rd = rd_alloc(QUADD_EXTABS_SIZE);
 
        spin_lock(&ctx.lock);
 
@@ -1132,7 +1133,6 @@ int quadd_unwind_start(struct task_struct *task)
        if (rd_old)
                pr_warn("%s: warning: rd_old\n", __func__);
 
-       rd = rd_alloc(QUADD_EXTABS_SIZE);
        if (IS_ERR_OR_NULL(rd)) {
                pr_err("%s: error: rd_alloc\n", __func__);
                spin_unlock(&ctx.lock);