summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>2018-09-06 11:05:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-19 23:43:35 +0300
commit381992bcccac4185ccdbbd2d9a3018238982b963 (patch)
treec6c77d4967e58135343b16e80d3fb71a69cec89b
parent23ecbbad7bf921f83a5c99718ded203676ddd91c (diff)
downloadlinux-381992bcccac4185ccdbbd2d9a3018238982b963.tar.xz
block: bfq: swap puts in bfqg_and_blkg_put
commit d5274b3cd6a814ccb2f56d81ee87cbbf51bd4cf7 upstream. Fix trivial use-after-free. This could be last reference to bfqg. Fixes: 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when safe") Acked-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--block/bfq-cgroup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 4b571f3ea009..afbbe5750a1f 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -224,9 +224,9 @@ static void bfqg_and_blkg_get(struct bfq_group *bfqg)
void bfqg_and_blkg_put(struct bfq_group *bfqg)
{
- bfqg_put(bfqg);
-
blkg_put(bfqg_to_blkg(bfqg));
+
+ bfqg_put(bfqg);
}
void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq,