[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211228030335.1330070-1-yinxiujiang@kylinos.cn>
Date: Tue, 28 Dec 2021 11:03:35 +0800
From: Yin Xiujiang <yinxiujiang@...inos.cn>
To: skashyap@...vell.com, jhasan@...vell.com,
GR-QLogic-Storage-Upstream@...vell.com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, yinxiujiang@...inos.cn
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: bnx2fc: fix double free of skb in bnx2fc_rcv
In `bnx2fc_rcv`,if skb_share_check() return NULL,
the variable skb would be freed but not set to NULL,
then it would be freed in `goto err` again.
Signed-off-by: Yin Xiujiang <yinxiujiang@...inos.cn>
---
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 71fa62bd3083..07a91b1f05a2 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -432,7 +432,6 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
struct fcoe_ctlr *ctlr;
struct fcoe_rcv_info *fr;
struct fcoe_percpu_s *bg;
- struct sk_buff *tmp_skb;
interface = container_of(ptype, struct bnx2fc_interface,
fcoe_packet_type);
@@ -444,11 +443,10 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev,
goto err;
}
- tmp_skb = skb_share_check(skb, GFP_ATOMIC);
- if (!tmp_skb)
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (unlikely(!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");
--
2.30.0
Powered by blists - more mailing lists