From: Bryant G. Ly Date: Fri, 14 Jul 2017 13:11:04 +0000 (-0500) Subject: tcmu: free old string on reconfig X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ededd039d1b96035b23592c049efcae53922cfce;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git tcmu: free old string on reconfig On initial tcmu_configure_device call the info->name would have already been allocated and set, so on the second call make sure to free it first. Reported-by: Mike Christie Reviewed-by: Mike Christie Signed-off-by: Bryant G. Ly Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index db29b5cd0b95..942d094269fb 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1432,6 +1432,8 @@ static int tcmu_update_uio_info(struct tcmu_dev *udev) if (udev->dev_config[0]) snprintf(str + used, size - used, "/%s", udev->dev_config); + /* If the old string exists, free it */ + kfree(info->name); info->name = str; return 0;