]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
tcmu: free old string on reconfig
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>
Fri, 14 Jul 2017 13:11:04 +0000 (08:11 -0500)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 30 Jul 2017 22:23:21 +0000 (15:23 -0700)
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>
drivers/target/target_core_user.c

index db29b5cd0b95e2b959a679367ee37d46ae8edf12..942d094269fba5db66ff7e791dcfaab1c6acec15 100644 (file)
@@ -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;