[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CANTwqXB6cN3OH48JLOfiPORDqFOATWGK7A0aSo1fODDC9EQsbA@mail.gmail.com>
Date: Mon, 20 Apr 2020 15:06:33 +0800
From: 亿一 <teroincn@...il.com>
To: vishal@...lsio.com
Cc: netdev@...r.kernel.org
Subject: Fwd: drivers: target: iscsi: cxgbit: is there exist a memleak in cxgbit_create_server4?
Hi, all:
When reviewing code of cxgbit_create_server4, what if
cxgb4_create_server return a >0 value, the cnp reference wouldn't be
released. Or, when cxgb4_create_server return >0 value, cnp has been
released somewhere.
static int
cxgbit_create_server4(struct cxgbit_device *cdev, unsigned int stid,
struct cxgbit_np *cnp)
{
struct sockaddr_in *sin = (struct sockaddr_in *)
&cnp->com.local_addr;
int ret;
pr_debug("%s: dev = %s; stid = %u; sin_port = %u\n",
__func__, cdev->lldi.ports[0]->name, stid, sin->sin_port);
cxgbit_get_cnp(cnp);
cxgbit_init_wr_wait(&cnp->com.wr_wait);
ret = cxgb4_create_server(cdev->lldi.ports[0],
stid, sin->sin_addr.s_addr,
sin->sin_port, 0,
cdev->lldi.rxq_ids[0]);
if (!ret)
ret = cxgbit_wait_for_reply(cdev, &cnp->com.wr_wait,
0, 10, __func__);
else if (ret > 0)
ret = net_xmit_errno(ret);
else
cxgbit_put_cnp(cnp);
if (ret)
pr_err("create server failed err %d stid %d laddr %pI4 lport %d\n",
ret, stid, &sin->sin_addr, ntohs(sin->sin_port));
return ret;
}
Powered by blists - more mailing lists