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]
Message-ID: <3502ed81-7d97-4a01-806f-5c5ae307b6af@oracle.com>
Date: Fri, 25 Jul 2025 19:34:56 +0530
From: ALOK TIWARI <alok.a.tiwari@...cle.com>
To: Parvathi Pudi <parvathi@...thit.com>, danishanwar@...com,
        rogerq@...nel.org, andrew+netdev@...n.ch, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
        robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
        ssantosh@...nel.org, richardcochran@...il.com, s.hauer@...gutronix.de,
        m-karicheri2@...com, glaroque@...libre.com, afd@...com,
        saikrishnag@...vell.com, m-malladi@...com, jacob.e.keller@...el.com,
        kory.maincent@...tlin.com, diogo.ivo@...mens.com,
        javier.carrasco.cruz@...il.com, horms@...nel.org, s-anna@...com,
        basharath@...thit.com
Cc: linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        vadim.fedorenko@...ux.dev, pratheesh@...com, prajith@...com,
        vigneshr@...com, praneeth@...com, srk@...com, rogerq@...com,
        krishna@...thit.com, pmohan@...thit.com, mohan@...thit.com
Subject: Re: [PATCH net-next v12 5/5] net: ti: prueth: Adds IEP support for
 PRUETH on AM33x, AM43x and AM57x SOCs



On 7/24/2025 2:40 PM, Parvathi Pudi wrote:
> Added API hooks for IEP module (legacy 32-bit model) to support
> timestamping requests from application.
> 
> Signed-off-by: Roger Quadros <rogerq@...com>
> Signed-off-by: Andrew F. Davis <afd@...com>
> Signed-off-by: Basharath Hussain Khaja <basharath@...thit.com>
> Signed-off-by: Parvathi Pudi <parvathi@...thit.com>
> ---
>   drivers/net/ethernet/ti/icssg/icss_iep.c      | 103 ++++++++++++++++++
>   drivers/net/ethernet/ti/icssm/icssm_prueth.c  |  72 +++++++++++-
>   drivers/net/ethernet/ti/icssm/icssm_prueth.h  |   2 +
>   .../net/ethernet/ti/icssm/icssm_prueth_ptp.h  |  85 +++++++++++++++
>   4 files changed, 260 insertions(+), 2 deletions(-)
>   create mode 100644 drivers/net/ethernet/ti/icssm/icssm_prueth_ptp.h
> 
> diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c
> index 2a1c43316f46..59aca63e2fe5 100644
> --- a/drivers/net/ethernet/ti/icssg/icss_iep.c
> +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c
> @@ -968,11 +968,114 @@ static const struct icss_iep_plat_data am654_icss_iep_plat_data = {
>   	.config = &am654_icss_iep_regmap_config,
>   };
>   
> +static const struct icss_iep_plat_data am57xx_icss_iep_plat_data = {
> +	.flags = ICSS_IEP_64BIT_COUNTER_SUPPORT |
> +		 ICSS_IEP_SLOW_COMPEN_REG_SUPPORT,
> +	.reg_offs = {
> +		[ICSS_IEP_GLOBAL_CFG_REG] = 0x00,
> +		[ICSS_IEP_COMPEN_REG] = 0x08,
> +		[ICSS_IEP_SLOW_COMPEN_REG] = 0x0C,

using both uppercase and lowercase hex

> +		[ICSS_IEP_COUNT_REG0] = 0x10,
> +		[ICSS_IEP_COUNT_REG1] = 0x14,
> +		[ICSS_IEP_CAPTURE_CFG_REG] = 0x18,
> +		[ICSS_IEP_CAPTURE_STAT_REG] = 0x1c,
> +
> +		[ICSS_IEP_CAP6_RISE_REG0] = 0x50,
> +		[ICSS_IEP_CAP6_RISE_REG1] = 0x54,
> +
> +		[ICSS_IEP_CAP7_RISE_REG0] = 0x60,
> +		[ICSS_IEP_CAP7_RISE_REG1] = 0x64,
> +
> +		[ICSS_IEP_CMP_CFG_REG] = 0x70,
> +		[ICSS_IEP_CMP_STAT_REG] = 0x74,
> +		[ICSS_IEP_CMP0_REG0] = 0x78,
> +		[ICSS_IEP_CMP0_REG1] = 0x7c,
> +		[ICSS_IEP_CMP1_REG0] = 0x80,
> +		[ICSS_IEP_CMP1_REG1] = 0x84,
> +
> +		[ICSS_IEP_CMP8_REG0] = 0xc0,
> +		[ICSS_IEP_CMP8_REG1] = 0xc4,
> +		[ICSS_IEP_SYNC_CTRL_REG] = 0x180,
> +		[ICSS_IEP_SYNC0_STAT_REG] = 0x188,
> +		[ICSS_IEP_SYNC1_STAT_REG] = 0x18c,
> +		[ICSS_IEP_SYNC_PWIDTH_REG] = 0x190,
> +		[ICSS_IEP_SYNC0_PERIOD_REG] = 0x194,
> +		[ICSS_IEP_SYNC1_DELAY_REG] = 0x198,
> +		[ICSS_IEP_SYNC_START_REG] = 0x19c,
> +	},
> +	.config = &am654_icss_iep_regmap_config,
> +};
> +
> +static bool am335x_icss_iep_valid_reg(struct device *dev, unsigned int reg)
> +{
> +	switch (reg) {
> +	case ICSS_IEP_GLOBAL_CFG_REG ... ICSS_IEP_CAPTURE_STAT_REG:
> +	case ICSS_IEP_CAP6_RISE_REG0:
> +	case ICSS_IEP_CMP_CFG_REG ... ICSS_IEP_CMP0_REG0:
> +	case ICSS_IEP_CMP8_REG0 ... ICSS_IEP_SYNC_START_REG:
> +		return true;
> +	default:
> +		return false;
> +	}
> +
> +	return false;

Redundant code after default return

> +}
> +
[clip]
>   
> @@ -1434,12 +1490,19 @@ static int icssm_prueth_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> +	prueth->iep = icss_iep_get(np);
> +	if (IS_ERR(prueth->iep)) {
> +		ret = PTR_ERR(prueth->iep);
> +		dev_err(dev, "unable to get IEP\n");
> +		goto netdev_exit;
> +	}
> +
>   	/* register the network devices */
>   	if (eth0_node) {
>   		ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev);
>   		if (ret) {
>   			dev_err(dev, "can't register netdev for port MII0");
> -			goto netdev_exit;
> +			goto iep_put;
>   		}
>   
>   		prueth->registered_netdevs[PRUETH_MAC0] =
> @@ -1473,6 +1536,9 @@ static int icssm_prueth_probe(struct platform_device *pdev)
>   		unregister_netdev(prueth->registered_netdevs[i]);
>   	}
>   
> +iep_put:
> +	icss_iep_put(prueth->iep);

prueth->iep = NULL; avoid potential use-after-free

> +
>   netdev_exit:
>   	for (i = 0; i < PRUETH_NUM_MACS; i++) {
>   		eth_node = prueth->eth_node[i];
> @@ -1541,6 +1607,8 @@ static void icssm_prueth_remove(struct platform_device *pdev)
>   						 &prueth->mem[i]);
>   	}
>   
> +	icss_iep_put(prueth->iep);
> +
>   	pruss_put(prueth->pruss);
>   

Thanks,
Alok

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ