Re: cdc_ncm uses stack memory for DMA

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

 



On Tue, Aug 02, 2011 at 02:00:16PM +0200, Alexey ORISHKO wrote:
> > -----Original Message-----
> > From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx]
> > On Behalf Of Josh Boyer
> > Sent: Tuesday, August 02, 2011 1:02 PM
> 
> > 
> > -		err = cdc_ncm_do_request(ctx, &req, &max_datagram_size, 0, NULL,
> > +		err = cdc_ncm_do_request(ctx, &req, max_datagram_size, 0, NULL,
> >  									1000);
> > +
> >  		if (err) {
> >  			pr_debug("GET_MAX_DATAGRAM_SIZE failed, use size=%u\n",
> >  						CDC_NCM_MIN_DATAGRAM_SIZE);
> 
> You miss to free it here.

Ah, yes.  Will fix it.

> 
> >  		} else {
> > -			ctx->max_datagram_size = le16_to_cpu(max_datagram_size);
> > +			ctx->max_datagram_size = le16_to_cpu(*max_datagram_size);
> >  			/* Check Eth descriptor value */
> >  			if (eth_max_sz < CDC_NCM_MAX_DATAGRAM_SIZE) {
> >  				if (ctx->max_datagram_size > eth_max_sz)
> > @@ -401,10 +423,12 @@ static u8 cdc_ncm_setup(struct cdc_ncm_ctx *ctx)
> >  			req.wValue = 0;
> >  			req.wIndex = cpu_to_le16(iface_no);
> >  			req.wLength = 2;
> > -			max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
> > +			*max_datagram_size = cpu_to_le16(ctx->max_datagram_size);
> > 
> > -			err = cdc_ncm_do_request(ctx, &req, &max_datagram_size,
> > +			err = cdc_ncm_do_request(ctx, &req, max_datagram_size,
> >  								0, NULL, 1000);
> > +			kfree(max_datagram_size);
> > +max_dgram_err:
> >  			if (err)
> >  				pr_debug("SET_MAX_DATAGRAM_SIZE failed\n");
> >  		}
> > --
> 
> 
> You have mem leak in case of request failure. Will you resubmit it with this change?

Yes.

> I have HW available and can test this patch on Ubuntu 11.04.

Great!

josh
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux