diff mbox series

block: bfq: swap puts in bfqg_and_blkg_put

Message ID 153622114435.533797.15694137158197822778.stgit@buzz (mailing list archive)
State New, archived
Headers show
Series block: bfq: swap puts in bfqg_and_blkg_put | expand

Commit Message

Konstantin Khlebnikov Sept. 6, 2018, 8:05 a.m. UTC
Fix trivial use-after-free. This could be last reference to bfqg.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fixes: 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when safe")
---
 block/bfq-cgroup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paolo Valente Sept. 6, 2018, 5:30 p.m. UTC | #1
> Il giorno 06 set 2018, alle ore 10:05, Konstantin Khlebnikov <khlebnikov@yandex-team.ru> ha scritto:
> 
> Fix trivial use-after-free. This could be last reference to bfqg.
> 

Acked-by: Paolo Valente <paolo.valente@linaro.org>

> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Fixes: 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when safe")
> ---
> block/bfq-cgroup.c |    4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
> index 58c6efa9f9a9..9fe5952d117d 100644
> --- a/block/bfq-cgroup.c
> +++ b/block/bfq-cgroup.c
> @@ -275,9 +275,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);
> }
> 
> /* @stats = 0 */
>
Jens Axboe Sept. 6, 2018, 5:33 p.m. UTC | #2
On 9/6/18 2:05 AM, Konstantin Khlebnikov wrote:
> Fix trivial use-after-free. This could be last reference to bfqg.

Applied, thanks.
diff mbox series

Patch

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 58c6efa9f9a9..9fe5952d117d 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -275,9 +275,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);
 }
 
 /* @stats = 0 */