Commit 1fe1fdb0 authored by Varun Prakash's avatar Varun Prakash Committed by Martin K. Petersen

scsi: cxgb4i: libcxgbi: add missing module_put()

Add module_put() in cxgbi_sock_act_open_req_arp_failure() to release
module reference in case of arp failure, also check return value of
try_module_get() before posting active open hw cmd.
Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 44830d8f
...@@ -801,7 +801,7 @@ static void do_act_establish(struct cxgbi_device *cdev, struct sk_buff *skb) ...@@ -801,7 +801,7 @@ static void do_act_establish(struct cxgbi_device *cdev, struct sk_buff *skb)
(&csk->saddr), (&csk->daddr), (&csk->saddr), (&csk->daddr),
atid, tid, csk, csk->state, csk->flags, rcv_isn); atid, tid, csk, csk->state, csk->flags, rcv_isn);
module_put(THIS_MODULE); module_put(cdev->owner);
cxgbi_sock_get(csk); cxgbi_sock_get(csk);
csk->tid = tid; csk->tid = tid;
...@@ -950,7 +950,7 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) ...@@ -950,7 +950,7 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
if (is_neg_adv(status)) if (is_neg_adv(status))
goto rel_skb; goto rel_skb;
module_put(THIS_MODULE); module_put(cdev->owner);
if (status && status != CPL_ERR_TCAM_FULL && if (status && status != CPL_ERR_TCAM_FULL &&
status != CPL_ERR_CONN_EXIST && status != CPL_ERR_CONN_EXIST &&
...@@ -1713,7 +1713,11 @@ static int init_act_open(struct cxgbi_sock *csk) ...@@ -1713,7 +1713,11 @@ static int init_act_open(struct cxgbi_sock *csk)
csk->mtu, csk->mss_idx, csk->smac_idx); csk->mtu, csk->mss_idx, csk->smac_idx);
/* must wait for either a act_open_rpl or act_open_establish */ /* must wait for either a act_open_rpl or act_open_establish */
try_module_get(THIS_MODULE); if (!try_module_get(cdev->owner)) {
pr_err("%s, try_module_get failed.\n", ndev->name);
goto rel_resource;
}
cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN);
if (csk->csk_family == AF_INET) if (csk->csk_family == AF_INET)
send_act_open_req(csk, skb, csk->l2t); send_act_open_req(csk, skb, csk->l2t);
...@@ -2027,6 +2031,7 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi) ...@@ -2027,6 +2031,7 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN; cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN;
cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr); cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
cdev->itp = &cxgb4i_iscsi_transport; cdev->itp = &cxgb4i_iscsi_transport;
cdev->owner = THIS_MODULE;
cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0])) cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0]))
<< FW_VIID_PFN_S; << FW_VIID_PFN_S;
......
...@@ -896,6 +896,7 @@ EXPORT_SYMBOL_GPL(cxgbi_sock_fail_act_open); ...@@ -896,6 +896,7 @@ EXPORT_SYMBOL_GPL(cxgbi_sock_fail_act_open);
void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb) void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb)
{ {
struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk; struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk;
struct module *owner = csk->cdev->owner;
log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n", log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n",
csk, (csk)->state, (csk)->flags, (csk)->tid); csk, (csk)->state, (csk)->flags, (csk)->tid);
...@@ -906,6 +907,8 @@ void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb) ...@@ -906,6 +907,8 @@ void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb)
spin_unlock_bh(&csk->lock); spin_unlock_bh(&csk->lock);
cxgbi_sock_put(csk); cxgbi_sock_put(csk);
__kfree_skb(skb); __kfree_skb(skb);
module_put(owner);
} }
EXPORT_SYMBOL_GPL(cxgbi_sock_act_open_req_arp_failure); EXPORT_SYMBOL_GPL(cxgbi_sock_act_open_req_arp_failure);
......
...@@ -468,6 +468,7 @@ struct cxgbi_device { ...@@ -468,6 +468,7 @@ struct cxgbi_device {
struct pci_dev *pdev; struct pci_dev *pdev;
struct dentry *debugfs_root; struct dentry *debugfs_root;
struct iscsi_transport *itp; struct iscsi_transport *itp;
struct module *owner;
unsigned int pfvf; unsigned int pfvf;
unsigned int rx_credit_thres; unsigned int rx_credit_thres;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment