Re: [PATCH v1] tcmu: free old string on reconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/14/2017 08:11 AM, Bryant G. Ly wrote:
> 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@xxxxxxxxxx>
> Signed-off-by: Bryant G. Ly <bryantly@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/target/target_core_user.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 80ee130..e366260 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1433,6 +1433,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;
> 

Reviewed-by: Mike Christie <mchristi@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux