diff options
author | Varun Prakash <varun@chelsio.com> | 2016-12-07 10:36:45 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-12-14 15:11:17 -0500 |
commit | 1fe1fdb04b92f54b58eb8b71d2f28cf73fd9801c (patch) | |
tree | 3c21c2a8c90ac3f30e4a3b682ae0a533c861e1f1 /drivers/scsi/cxgbi | |
parent | 44830d8fd28a729729d14bb160341a6170631eb7 (diff) |
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: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/cxgbi')
-rw-r--r-- | drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 11 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 3 | ||||
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.h | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 57401b58efce..9a2fdc305cf2 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -801,7 +801,7 @@ static void do_act_establish(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
801 | (&csk->saddr), (&csk->daddr), | 801 | (&csk->saddr), (&csk->daddr), |
802 | atid, tid, csk, csk->state, csk->flags, rcv_isn); | 802 | atid, tid, csk, csk->state, csk->flags, rcv_isn); |
803 | 803 | ||
804 | module_put(THIS_MODULE); | 804 | module_put(cdev->owner); |
805 | 805 | ||
806 | cxgbi_sock_get(csk); | 806 | cxgbi_sock_get(csk); |
807 | csk->tid = tid; | 807 | csk->tid = tid; |
@@ -950,7 +950,7 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
950 | if (is_neg_adv(status)) | 950 | if (is_neg_adv(status)) |
951 | goto rel_skb; | 951 | goto rel_skb; |
952 | 952 | ||
953 | module_put(THIS_MODULE); | 953 | module_put(cdev->owner); |
954 | 954 | ||
955 | if (status && status != CPL_ERR_TCAM_FULL && | 955 | if (status && status != CPL_ERR_TCAM_FULL && |
956 | status != CPL_ERR_CONN_EXIST && | 956 | status != CPL_ERR_CONN_EXIST && |
@@ -1713,7 +1713,11 @@ static int init_act_open(struct cxgbi_sock *csk) | |||
1713 | csk->mtu, csk->mss_idx, csk->smac_idx); | 1713 | csk->mtu, csk->mss_idx, csk->smac_idx); |
1714 | 1714 | ||
1715 | /* must wait for either a act_open_rpl or act_open_establish */ | 1715 | /* must wait for either a act_open_rpl or act_open_establish */ |
1716 | try_module_get(THIS_MODULE); | 1716 | if (!try_module_get(cdev->owner)) { |
1717 | pr_err("%s, try_module_get failed.\n", ndev->name); | ||
1718 | goto rel_resource; | ||
1719 | } | ||
1720 | |||
1717 | cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); | 1721 | cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN); |
1718 | if (csk->csk_family == AF_INET) | 1722 | if (csk->csk_family == AF_INET) |
1719 | send_act_open_req(csk, skb, csk->l2t); | 1723 | send_act_open_req(csk, skb, csk->l2t); |
@@ -2027,6 +2031,7 @@ static void *t4_uld_add(const struct cxgb4_lld_info *lldi) | |||
2027 | cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN; | 2031 | cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN; |
2028 | cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr); | 2032 | cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr); |
2029 | cdev->itp = &cxgb4i_iscsi_transport; | 2033 | cdev->itp = &cxgb4i_iscsi_transport; |
2034 | cdev->owner = THIS_MODULE; | ||
2030 | 2035 | ||
2031 | cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0])) | 2036 | cdev->pfvf = FW_VIID_PFN_G(cxgb4_port_viid(lldi->ports[0])) |
2032 | << FW_VIID_PFN_S; | 2037 | << FW_VIID_PFN_S; |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index eb4af124d5cd..9f4fde9b12e3 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -896,6 +896,7 @@ EXPORT_SYMBOL_GPL(cxgbi_sock_fail_act_open); | |||
896 | void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb) | 896 | void cxgbi_sock_act_open_req_arp_failure(void *handle, struct sk_buff *skb) |
897 | { | 897 | { |
898 | struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk; | 898 | struct cxgbi_sock *csk = (struct cxgbi_sock *)skb->sk; |
899 | struct module *owner = csk->cdev->owner; | ||
899 | 900 | ||
900 | log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n", | 901 | log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n", |
901 | csk, (csk)->state, (csk)->flags, (csk)->tid); | 902 | 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 | spin_unlock_bh(&csk->lock); | 907 | spin_unlock_bh(&csk->lock); |
907 | cxgbi_sock_put(csk); | 908 | cxgbi_sock_put(csk); |
908 | __kfree_skb(skb); | 909 | __kfree_skb(skb); |
910 | |||
911 | module_put(owner); | ||
909 | } | 912 | } |
910 | EXPORT_SYMBOL_GPL(cxgbi_sock_act_open_req_arp_failure); | 913 | EXPORT_SYMBOL_GPL(cxgbi_sock_act_open_req_arp_failure); |
911 | 914 | ||
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 85bae613d860..95ba99044c3e 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h | |||
@@ -468,6 +468,7 @@ struct cxgbi_device { | |||
468 | struct pci_dev *pdev; | 468 | struct pci_dev *pdev; |
469 | struct dentry *debugfs_root; | 469 | struct dentry *debugfs_root; |
470 | struct iscsi_transport *itp; | 470 | struct iscsi_transport *itp; |
471 | struct module *owner; | ||
471 | 472 | ||
472 | unsigned int pfvf; | 473 | unsigned int pfvf; |
473 | unsigned int rx_credit_thres; | 474 | unsigned int rx_credit_thres; |