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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220329091848.tfzoszmvjp47jre5@skbuf>
Date:   Tue, 29 Mar 2022 09:18:49 +0000
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Zheng Yongjun <zhengyongjun3@...wei.com>
CC:     "andrew@...n.ch" <andrew@...n.ch>,
        "vivien.didelot@...il.com" <vivien.didelot@...il.com>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Claudiu Manoil <claudiu.manoil@....com>,
        "alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
        "UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>
Subject: Re: [PATCH v2] net: dsa: felix: fix possible NULL pointer dereference

On Tue, Mar 29, 2022 at 09:08:00AM +0000, Zheng Yongjun wrote:
> As the possible failure of the allocation, kzalloc() may return NULL
> pointer.
> Therefore, it should be better to check the 'sgi' in order to prevent
> the dereference of NULL pointer.
> 
> Fixes: 23ae3a7877718 ("net: dsa: felix: add stream gate settings for psfp").
> Signed-off-by: Zheng Yongjun <zhengyongjun3@...wei.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@....com>

> 
> v1->v2:Rewrite fixes tag, delete extra 'q'.
> 
>  drivers/net/dsa/ocelot/felix_vsc9959.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 33f0ceae381d..2875b5250856 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -1940,6 +1940,10 @@ static int vsc9959_psfp_filter_add(struct ocelot *ocelot, int port,
>  		case FLOW_ACTION_GATE:
>  			size = struct_size(sgi, entries, a->gate.num_entries);
>  			sgi = kzalloc(size, GFP_KERNEL);
> +			if (!sgi) {
> +				ret = -ENOMEM;
> +				goto err;
> +			}
>  			vsc9959_psfp_parse_gate(a, sgi);
>  			ret = vsc9959_psfp_sgi_table_add(ocelot, sgi);
>  			if (ret) {
> -- 
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ