Skip to contentSkip to conversation

block: bfq: swap puts in bfqg_and_blkg_put

PATCH Applied Konstantin Khlebnikov 3 participants 3 messages Sep 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: bfq: swap puts in bfqg_and_blkg_put

Fix trivial use-after-free. This could be last reference to bfqg.

Fixes 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when safe")
---
 block/bfq-cgroup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/bfq-cgroup.c +2 -2
index 58c6efa9f9a9..9fe5952d117d 100644
@@ -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 */
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines

Il giorno 06 set 2018, alle ore 10:05, Konstantin Khlebnikov =

<[email protected]> ha scritto:

Quoted 3 lines

=20
Fix trivial use-after-free. This could be last reference to bfqg. =20

Quoted 2 lines
Fixes 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when =

safe")

block/bfq-cgroup.c static void bfqg_and_blkg_get(struct bfq_group =

Quoted 9 lines

---
block/bfq-cgroup.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

=20

block/bfq-cgroup.c +0 -0
index 58c6efa9f9a9..9fe5952d117d 100644
@@ -275,9 +275,9 @@ static void bfqg_and_blkg_get(struct bfq_group =

*bfqg)

Quoted 12 lines

=20
void bfqg_and_blkg_put(struct bfq_group *bfqg)
{

block/bfq-cgroup.c +0 -2
-	bfqg_put(bfqg);
-
	blkg_put(bfqg_to_blkg(bfqg));
block/bfq-cgroup.c +2 -0
+
+	bfqg_put(bfqg);

}
=20
/* @stats =3D 0 */
=20