lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210328081603.5428-1-lyl2019@mail.ustc.edu.cn>
Date:   Sun, 28 Mar 2021 01:16:03 -0700
From:   Lv Yunlong <lyl2019@...l.ustc.edu.cn>
To:     skashyap@...vell.com, jhasan@...vell.com,
        GR-QLogic-Storage-Upstream@...vell.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Subject: [PATCH] scsi/bnx2fc/bnx2fx_fcore: Fix a double free in bnx2fc_rcv

In bnx2fc_rcv, it calls skb_share_check(skb,GFP_ATOMIC) to clone
the skb. But if skb_clone() failed, skb_share_check() will free
the skb in the first time and return NULL. Then skb_share_check()
returns NULL and goto err.

Unfortunately, the same skb is freed in the second time in err.

I think moving skb = tmp_skb in front of if(!tmp_err) goto err
is a good solution, because freeing a NULL skb is safe.

Fixes: 01a4cc4d0cd6a ("bnx2fc: do not add shared skbs to the fcoe_rx_list")
Signed-off-by: Lv Yunlong <lyl2019@...l.ustc.edu.cn>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 16bb6d2f98de..2e213d336ebe 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -445,11 +445,11 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
 	}
 
 	tmp_skb = skb_share_check(skb, GFP_ATOMIC);
+	skb = tmp_skb;
+
 	if (!tmp_skb)
 		goto err;
 
-	skb = tmp_skb;
-
 	if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) {
 		printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n");
 		goto err;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ