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:   Thu, 16 Mar 2023 09:00:57 +0000
From:   Geethasowjanya Akula <gakula@...vell.com>
To:     Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
CC:     Sunil Kovvuri Goutham <sgoutham@...vell.com>,
        Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
        Hariprasad Kelam <hkelam@...vell.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "richardcochran@...il.com" <richardcochran@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [EXT] Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu



>-----Original Message-----
>From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com> 
>Sent: Thursday, March 16, 2023 1:40 PM
>To: Jiasheng Jiang <jiasheng@...as.ac.cn>
>Cc: Sunil Kovvuri Goutham <sgoutham@...vell.com>; Geethasowjanya Akula <gakula@...vell.com>; Subbaraya Sundeep Bhatta <sbhatta@...vell.com>; Hariprasad Kelam <hkelam@...vell.com>; >davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org; pabeni@...hat.com; richardcochran@...il.com; netdev@...r.kernel.org; linux-kernel@...r.kernel.org
>Subject: [EXT] Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu

>External Email

>----------------------------------------------------------------------
>On Thu, Mar 16, 2023 at 10:39:11AM +0800, Jiasheng Jiang wrote:
>> Add the free_percpu for the allocated "vf->hw.lmt_info" in order to 
>> avoid memory leak, same as the "pf->hw.lmt_info" in 
>> `drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c`.
>> 
>> Fixes: 5c0512072f65 ("octeontx2-pf: cn10k: Use runtime allocated 
>> LMTLINE region")
>> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
>> ---
>>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c 
>> b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> index 7f8ffbf79cf7..9db2e2d218bb 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>> @@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, 
>> const struct pci_device_id *id)
>>  err_ptp_destroy:
>>  	otx2_ptp_destroy(vf);
>>  err_detach_rsrc:
>> +	if (vf->hw.lmt_info)
>> +		free_percpu(vf->hw.lmt_info);
>>  	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
>>  		qmem_free(vf->dev, vf->dync_lmt);
>I wonder if it wouldn't be more error prune when You create a function to unroll cn10k_lmtst_init() like cn10k_lmtst_deinit(). These two if can be there, maybe also sth else is missing.

>Otherwise it is fine
>Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>

>>  	otx2_detach_resources(&vf->mbox);
>> @@ -762,6 +764,8 @@ static void otx2vf_remove(struct pci_dev *pdev)
>>  	otx2_shutdown_tc(vf);
>>  	otx2vf_disable_mbox_intr(vf);
>>  	otx2_detach_resources(&vf->mbox);
>> +	if (vf->hw.lmt_info)
>> +		free_percpu(vf->hw.lmt_info);

Ack. Thanks for the patch.

>>  	if (test_bit(CN10K_LMTST, &vf->hw.cap_flag))
>>  		qmem_free(vf->dev, vf->dync_lmt);
>>  	otx2vf_vfaf_mbox_destroy(vf);
>> --
>> 2.25.1
>> 

Geetha.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ