Re: [PATCH v2] block: fix memory leak for elevator on add_disk failure

From: Jason Yan
Date: Sat Oct 22 2022 - 07:02:06 EST



On 2022/10/22 10:16, Yu Kuai wrote:
From: Yu Kuai<yukuai3@xxxxxxxxxx>

The default elevator is allocated in the beginning of device_add_disk(),
however, it's not freed in the following error path.

Fixes: 50e34d78815e ("block: disable the elevator int del_gendisk")
Signed-off-by: Yu Kuai<yukuai3@xxxxxxxxxx>
Reviewed-by: Christoph Hellwig<hch@xxxxxx>
---
Changes in v2:
- fix wrong fix tag
- add review tag

block/genhd.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Jason Yan <yanaijie@xxxxxxxxxx>