mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
scsi: scsi_debug: Fix memleak in scsi_debug_init()
When sdeb_zbc_model does not match BLK_ZONED_NONE, BLK_ZONED_HA or BLK_ZONED_HM, we should free sdebug_q_arr to prevent memleak. Also there is no need to execute sdebug_erase_store() on failure of sdeb_zbc_model_str(). Link: https://lore.kernel.org/r/20201226061503.20050-1-dinghao.liu@zju.edu.cn Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
39718fe7ad
commit
3b01d7ea4d
1 changed files with 3 additions and 2 deletions
|
@ -6740,7 +6740,7 @@ static int __init scsi_debug_init(void)
|
||||||
k = sdeb_zbc_model_str(sdeb_zbc_model_s);
|
k = sdeb_zbc_model_str(sdeb_zbc_model_s);
|
||||||
if (k < 0) {
|
if (k < 0) {
|
||||||
ret = k;
|
ret = k;
|
||||||
goto free_vm;
|
goto free_q_arr;
|
||||||
}
|
}
|
||||||
sdeb_zbc_model = k;
|
sdeb_zbc_model = k;
|
||||||
switch (sdeb_zbc_model) {
|
switch (sdeb_zbc_model) {
|
||||||
|
@ -6753,7 +6753,8 @@ static int __init scsi_debug_init(void)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("Invalid ZBC model\n");
|
pr_err("Invalid ZBC model\n");
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto free_q_arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sdeb_zbc_model != BLK_ZONED_NONE) {
|
if (sdeb_zbc_model != BLK_ZONED_NONE) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue