aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>2017-07-14 08:11:04 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2017-07-30 15:23:21 -0700
commitededd039d1b96035b23592c049efcae53922cfce (patch)
tree36eeb68d6d9fcf2c2ac8ea0e8c35c62fc2c4d172 /drivers/target
parenttcmu: Fix possible to/from address overflow when doing the memcpy (diff)
downloadlinux-dev-ededd039d1b96035b23592c049efcae53922cfce.tar.xz
linux-dev-ededd039d1b96035b23592c049efcae53922cfce.zip
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 <mchristi@redhat.com> Reviewed-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_user.c2
1 files changed, 2 insertions, 0 deletions
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;