Re: [RESEND PATCH] target: fix potential memory leak in option parsing

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

 



On 06/13/2018 12:27 AM, Chengguang Xu wrote:
> When specifying same string type option several times,
> current option parsing will cause memory leak. Hence,
> call kfree for previous one in this case.
> 
> Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
> ---
>  drivers/target/target_core_configfs.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
> index 5ccef7d..5512432 100644
> --- a/drivers/target/target_core_configfs.c
> +++ b/drivers/target/target_core_configfs.c
> @@ -1661,6 +1661,7 @@ static ssize_t target_pr_res_aptpl_metadata_store(struct config_item *item,
>  		token = match_token(ptr, tokens, args);
>  		switch (token) {
>  		case Opt_initiator_fabric:
> +			kfree(i_fabric);

You can probably just change this one and t_fabric so we do not even do
a match_strdup since they are not used. Just let them hit the default in
the switch so if apps are still passing them in then we maintain the
same behavior from their perspective.
--
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