scsi: target: iscsi: cxgbit: fix csk leak
authorVarun Prakash <varun@chelsio.com>
Fri, 9 Nov 2018 15:29:01 +0000 (20:59 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jan 2019 07:10:53 +0000 (08:10 +0100)
[ Upstream commit ed076c55b359cc9982ca8b065bcc01675f7365f6 ]

In case of arp failure call cxgbit_put_csk() to free csk.

Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/target/iscsi/cxgbit/cxgbit_cm.c

index 2fb1bf1a26c5e6a0488869cf91d29935a3301af1..8652475e01d0fba9b08e251706b0fcddb44270ae 100644 (file)
@@ -631,8 +631,11 @@ static void cxgbit_send_halfclose(struct cxgbit_sock *csk)
 
 static void cxgbit_arp_failure_discard(void *handle, struct sk_buff *skb)
 {
+       struct cxgbit_sock *csk = handle;
+
        pr_debug("%s cxgbit_device %p\n", __func__, handle);
        kfree_skb(skb);
+       cxgbit_put_csk(csk);
 }
 
 static void cxgbit_abort_arp_failure(void *handle, struct sk_buff *skb)
@@ -1136,7 +1139,7 @@ cxgbit_pass_accept_rpl(struct cxgbit_sock *csk, struct cpl_pass_accept_req *req)
        rpl5->opt0 = cpu_to_be64(opt0);
        rpl5->opt2 = cpu_to_be32(opt2);
        set_wr_txq(skb, CPL_PRIORITY_SETUP, csk->ctrlq_idx);
-       t4_set_arp_err_handler(skb, NULL, cxgbit_arp_failure_discard);
+       t4_set_arp_err_handler(skb, csk, cxgbit_arp_failure_discard);
        cxgbit_l2t_send(csk->com.cdev, skb, csk->l2t);
 }