[openib-general] Re: [PATCH/RFC v2] IB: Add SCSI RDMA Protocol(SRP) initiator

Rimmer, Todd trimmer at silverstorm.com
Wed Nov 2 14:04:07 PST 2005


also leaks it on success

> -----Original Message-----
> From: Michael S. Tsirkin [mailto:mst at mellanox.co.il]
> Sent: Wednesday, November 02, 2005 5:04 PM
> To: Roland Dreier
> Cc: openib-general at openib.org; linux-kernel at vger.kernel.org;
> linux-scsi at vger.kernel.org
> Subject: [openib-general] Re: [PATCH/RFC v2] IB: Add SCSI RDMA
> Protocol(SRP) initiator
> 
> 
> Hello, Roland!
> Quoting Roland Dreier <rolandd at cisco.com>:
> > +static int srp_init_qp(struct srp_target_port *target,
> > +		       struct ib_qp *qp)
> > +{
> > +	struct ib_qp_attr *attr;
> > +	int ret;
> > +
> > +	attr = kmalloc(sizeof *attr, GFP_KERNEL);
> > +	if (!attr)
> > +		return -ENOMEM;
> > +
> > +	ret = ib_find_cached_pkey(target->srp_host->dev,
> > +				  target->srp_host->port,
> > +				  be16_to_cpu(target->path.pkey),
> > +				  &attr->pkey_index);
> > +	if (ret)
> > +		return ret;
> > +
> > +	attr->qp_state        = IB_QPS_INIT;
> > +	attr->qp_access_flags = (IB_ACCESS_REMOTE_READ |
> > +				    IB_ACCESS_REMOTE_WRITE);
> > +	attr->port_num        = target->srp_host->port;
> > +
> > +	return ib_modify_qp(qp, attr,
> > +			    IB_QP_STATE		|
> > +			    IB_QP_PKEY_INDEX	|
> > +			    IB_QP_ACCESS_FLAGS	|
> > +			    IB_QP_PORT);
> > +}
> 
> This seems to leak sizeof *attr bytes if ib_find_cached_pkey
> returns an error.
> 
> -- 
> MST
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit 
> http://openib.org/mailman/listinfo/openib-general
> 



More information about the general mailing list