瀏覽代碼

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>
Bryant G. Ly 8 年之前
父節點
當前提交
ededd039d1
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/target/target_core_user.c

+ 2 - 0
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])
 	if (udev->dev_config[0])
 		snprintf(str + used, size - used, "/%s", udev->dev_config);
 		snprintf(str + used, size - used, "/%s", udev->dev_config);
 
 
+	/* If the old string exists, free it */
+	kfree(info->name);
 	info->name = str;
 	info->name = str;
 
 
 	return 0;
 	return 0;