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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 2 Feb 2024 05:01:20 +0000
From: Subbaraya Sundeep Bhatta <sbhatta@...vell.com>
To: Zhipeng Lu <alexious@....edu.cn>
CC: Sunil Kovvuri Goutham <sgoutham@...vell.com>,
        Geethasowjanya Akula
	<gakula@...vell.com>,
        Hariprasad Kelam <hkelam@...vell.com>,
        "David S.
 Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub
 Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Jesse Brandeburg
	<jesse.brandeburg@...el.com>,
        Richard Cochran <richardcochran@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [EXT] [PATCH] octeontx2-pf: Fix a memleak otx2_sq_init

Looks good to me.

Thanks,
Sundeep

>-----Original Message-----
>From: Zhipeng Lu <alexious@....edu.cn>
>Sent: Thursday, February 1, 2024 6:17 PM
>To: alexious@....edu.cn
>Cc: Sunil Kovvuri Goutham <sgoutham@...vell.com>; Geethasowjanya Akula
><gakula@...vell.com>; Subbaraya Sundeep Bhatta <sbhatta@...vell.com>;
>Hariprasad Kelam <hkelam@...vell.com>; David S. Miller
><davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>; Jakub Kicinski
><kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>; Jesse Brandeburg
><jesse.brandeburg@...el.com>; Richard Cochran <richardcochran@...il.com>;
>netdev@...r.kernel.org; linux-kernel@...r.kernel.org
>Subject: [EXT] [PATCH] octeontx2-pf: Fix a memleak otx2_sq_init
>
>External Email
>
>----------------------------------------------------------------------
>When qmem_alloc and pfvf->hw_ops->sq_aq_init fails, sq->sg should be freed to
>prevent memleak.
>
>Fixes: c9c12d339d93 ("octeontx2-pf: Add support for PTP clock")
>Signed-off-by: Zhipeng Lu <alexious@....edu.cn>
>---
> .../ethernet/marvell/octeontx2/nic/otx2_common.c   | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>index 7ca6941ea0b9..02d0b707aea5 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>@@ -951,8 +951,11 @@ int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16
>sqb_aura)
> 	if (pfvf->ptp && qidx < pfvf->hw.tx_queues) {
> 		err = qmem_alloc(pfvf->dev, &sq->timestamps, qset->sqe_cnt,
> 				 sizeof(*sq->timestamps));
>-		if (err)
>+		if (err) {
>+			kfree(sq->sg);
>+			sq->sg = NULL;
> 			return err;
>+		}
> 	}
>
> 	sq->head = 0;
>@@ -968,7 +971,14 @@ int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16
>sqb_aura)
> 	sq->stats.bytes = 0;
> 	sq->stats.pkts = 0;
>
>-	return pfvf->hw_ops->sq_aq_init(pfvf, qidx, sqb_aura);
>+	err = pfvf->hw_ops->sq_aq_init(pfvf, qidx, sqb_aura);
>+	if (err) {
>+		kfree(sq->sg);
>+		sq->sg = NULL;
>+		return err;
>+	}
>+
>+	return 0;
>
> }
>
>--
>2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ