Re: [PATCH 08/12] be2iscsi: Fix MCC WRB leak in open_connection

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

 



On Mon, Feb 01, 2016 at 03:42:47PM +0530, Jitendra Bhivare wrote:
> In open with IP of unknown address family, only tag is freed and error
> returned. MCC WRB allocated for the operation is not freed.
> 
> Added check for supported family of IP in the beginning before
> allocating the tag and WRB.
> 
> Signed-off-by: Jitendra Bhivare <jitendra.bhivare@xxxxxxxxxxxxx>
> ---
>  drivers/scsi/be2iscsi/be_mgmt.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
> index 85044b8..ccac1d7 100644
> --- a/drivers/scsi/be2iscsi/be_mgmt.c
> +++ b/drivers/scsi/be2iscsi/be_mgmt.c
> @@ -829,6 +829,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  	unsigned short cid = beiscsi_ep->ep_cid;
>  	struct be_sge *sge;
>  
> +	if (dst_addr->sa_family != PF_INET && dst_addr->sa_family != PF_INET6) {
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> +			    "BG_%d : unknown addr family %d\n",
> +			    dst_addr->sa_family);
> +		return -EINVAL;
> +	}
> +
>  	phwi_ctrlr = phba->phwi_ctrlr;
>  	phwi_context = phwi_ctrlr->phwi_ctxt;
>  
> @@ -868,7 +875,8 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  		beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
>  		beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
>  		beiscsi_ep->ip_type = BE2_IPV4;
> -	} else if (dst_addr->sa_family == PF_INET6) {
> +	} else {
> +		/* else its PF_INET6 family */
>  		req->ip_address.ip_type = BE2_IPV6;
>  		memcpy(&req->ip_address.addr,
>  		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> @@ -877,14 +885,6 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
>  		memcpy(&beiscsi_ep->dst6_addr,
>  		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
>  		beiscsi_ep->ip_type = BE2_IPV6;
> -	} else{
> -		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> -			    "BG_%d : unknown addr family %d\n",
> -			    dst_addr->sa_family);
> -		mutex_unlock(&ctrl->mbox_lock);
> -		free_mcc_tag(&phba->ctrl, tag);
> -		return -EINVAL;
> -
>  	}
>  	req->cid = cid;
>  	i = phba->nxt_cqid++;
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@xxxxxxx                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux