summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-11-24 06:13:21 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-11-24 06:13:20 -0800
commit091685a6a4981ac01ab0ec61aa6d46b9d3ded294 (patch)
treef0eb1d895bbe7bb5fec192545d96b414e6d6eaa1
parentaff86d3b4f8abde05bef419a00de0ee2e9bb0d58 (diff)
parentf1c3024e5dc27398eb82af0f9ec4f686a83d41c7 (diff)
Merge "block: fix use-after-free in sys_ioprio_get()"
-rw-r--r--block/genhd.c1
-rw-r--r--block/ioprio.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 817c67c9e45e..82bc52cad1c1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -831,6 +831,7 @@ static void disk_seqf_stop(struct seq_file *seqf, void *v)
if (iter) {
class_dev_iter_exit(iter);
kfree(iter);
+ seqf->private = NULL;
}
}
diff --git a/block/ioprio.c b/block/ioprio.c
index cc7800e9eb44..01b8116298a1 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -150,8 +150,10 @@ static int get_task_ioprio(struct task_struct *p)
if (ret)
goto out;
ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);
+ task_lock(p);
if (p->io_context)
ret = p->io_context->ioprio;
+ task_unlock(p);
out:
return ret;
}