[ofa-general] cxio_hal_init_ctrl_qp() resource leak

Roland Dreier rdreier at cisco.com
Thu Mar 22 11:16:32 PDT 2007


Hey steve, coverity found this issue:

	static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
	{
		int err;
		u64 sge_cmd, ctx0, ctx1;
		u64 base_addr;
		struct t3_modify_qp_wr *wqe;
		struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL);
	
	
		if (!skb) {
			PDBG("%s alloc_skb failed\n", __FUNCTION__);
			return -ENOMEM;
		}

>>> skb is allocated here

		err = cxio_hal_init_ctrl_cq(rdev_p);
		if (err) {
			PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err);
			return err;
>>> but leaked here...
		}
		rdev_p->ctrl_qp.workq = dma_alloc_coherent(
						&(rdev_p->rnic_info.pdev->dev),
						(1 << T3_CTRL_QP_SIZE_LOG2) *
						sizeof(union t3_wr),
						&(rdev_p->ctrl_qp.dma_addr),
						GFP_KERNEL);
		if (!rdev_p->ctrl_qp.workq) {
			PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__);
			return -ENOMEM;
>>> ... and leaked here too
		}



More information about the general mailing list