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] [day] [month] [year] [list]
Message-ID: <AM6PR04MB397680E5084359739F2FC08EEC4E0@AM6PR04MB3976.eurprd04.prod.outlook.com>
Date:   Fri, 31 Jul 2020 07:48:34 +0000
From:   Madalin Bucur <madalin.bucur@....com>
To:     Florinel Iordache <florinel.iordache@....com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net 4/5] fsl/fman: check dereferencing null pointer

> -----Original Message-----
> From: Florinel Iordache <florinel.iordache@....com>
> Sent: 31 July 2020 09:46
> To: Madalin Bucur <madalin.bucur@....com>; davem@...emloft.net;
> kuba@...nel.org; netdev@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org; Florinel Iordache
> <florinel.iordache@....com>
> Subject: [PATCH net 4/5] fsl/fman: check dereferencing null pointer
> 
> Add a safe check to avoid dereferencing null pointer
> 
> Fixes: 57ba4c9b ("fsl/fman: Add FMan MAC support")
> 
> Signed-off-by: Florinel Iordache <florinel.iordache@....com>
> ---
>  drivers/net/ethernet/freescale/fman/fman_dtsec.c | 4 ++--
>  drivers/net/ethernet/freescale/fman/fman_memac.c | 3 ++-
>  drivers/net/ethernet/freescale/fman/fman_tgec.c  | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> index 004c266..bce3c93 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> @@ -1200,7 +1200,7 @@ int dtsec_del_hash_mac_address(struct fman_mac
> *dtsec, enet_addr_t *eth_addr)
>  		list_for_each(pos,
>  			      &dtsec->multicast_addr_hash->lsts[bucket]) {
>  			hash_entry = ETH_HASH_ENTRY_OBJ(pos);
> -			if (hash_entry->addr == addr) {
> +			if (hash_entry && hash_entry->addr == addr) {
>  				list_del_init(&hash_entry->node);
>  				kfree(hash_entry);
>  				break;
> @@ -1213,7 +1213,7 @@ int dtsec_del_hash_mac_address(struct fman_mac
> *dtsec, enet_addr_t *eth_addr)
>  		list_for_each(pos,
>  			      &dtsec->unicast_addr_hash->lsts[bucket]) {
>  			hash_entry = ETH_HASH_ENTRY_OBJ(pos);
> -			if (hash_entry->addr == addr) {
> +			if (hash_entry && hash_entry->addr == addr) {
>  				list_del_init(&hash_entry->node);
>  				kfree(hash_entry);
>  				break;
> diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c
> b/drivers/net/ethernet/freescale/fman/fman_memac.c
> index bb02b37..52ee982 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
> @@ -852,6 +852,7 @@ int memac_set_tx_pause_frames(struct fman_mac *memac,
> u8 priority,
> 
>  	tmp = ioread32be(&regs->command_config);
>  	tmp &= ~CMD_CFG_PFC_MODE;
> +	priority = 0;

This line seems to be added by mistake.

> 
>  	iowrite32be(tmp, &regs->command_config);
> 
> @@ -981,7 +982,7 @@ int memac_del_hash_mac_address(struct fman_mac *memac,
> enet_addr_t *eth_addr)
> 
>  	list_for_each(pos, &memac->multicast_addr_hash->lsts[hash]) {
>  		hash_entry = ETH_HASH_ENTRY_OBJ(pos);
> -		if (hash_entry->addr == addr) {
> +		if (hash_entry && hash_entry->addr == addr) {
>  			list_del_init(&hash_entry->node);
>  			kfree(hash_entry);
>  			break;
> diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> index 8c7eb87..41946b1 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> @@ -626,7 +626,7 @@ int tgec_del_hash_mac_address(struct fman_mac *tgec,
> enet_addr_t *eth_addr)
> 
>  	list_for_each(pos, &tgec->multicast_addr_hash->lsts[hash]) {
>  		hash_entry = ETH_HASH_ENTRY_OBJ(pos);
> -		if (hash_entry->addr == addr) {
> +		if (hash_entry && hash_entry->addr == addr) {
>  			list_del_init(&hash_entry->node);
>  			kfree(hash_entry);
>  			break;
> --
> 1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ