diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index b967c7c1b..22bf2dcad 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3500,6 +3500,12 @@ static int fileio_exec(struct scst_cmd *cmd) return vdev_do_job(cmd, ops); } +static void vdisk_on_free_cmd_params(const struct vdisk_cmd_params *p) +{ + if (p->iv != p->small_iv) + kfree(p->iv); +} + static void fileio_on_free_cmd(struct scst_cmd *cmd) { struct vdisk_cmd_params *p = cmd->dh_priv; @@ -3524,8 +3530,7 @@ static void fileio_on_free_cmd(struct scst_cmd *cmd) cmd->data_len = 0; } - if (p->iv != p->small_iv) - kfree(p->iv); + vdisk_on_free_cmd_params(p); kmem_cache_free(vdisk_cmd_param_cachep, p);