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: <ZBGMqfPQiR84NkMQ@nimitz>
Date:   Wed, 15 Mar 2023 10:15:21 +0100
From:   Piotr Raczynski <piotr.raczynski@...el.com>
To:     Liang He <windhl@....com>
CC:     <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>, <netdev@...r.kernel.org>
Subject: Re: [PATCH] ethernet: sun: add check for the mdesc_grab()

On Wed, Mar 15, 2023 at 02:00:21PM +0800, Liang He wrote:
> In vnet_port_probe() and vsw_port_probe(), we should
> check the return value of mdesc_grab() as it may
> return NULL which can caused NPD bugs.
> 
> Fixes: 5d01fa0c6bd8 ("ldmvsw: Add ldmvsw.c driver code")
> Fixes: 43fdf27470b2 ("[SPARC64]: Abstract out mdesc accesses for better MD update handling.")
> Signed-off-by: Liang He <windhl@....com>
> ---
>  drivers/net/ethernet/sun/ldmvsw.c  | 3 +++
>  drivers/net/ethernet/sun/sunvnet.c | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c
> index 8addee6d04bd..734a817d3c94 100644
> --- a/drivers/net/ethernet/sun/ldmvsw.c
> +++ b/drivers/net/ethernet/sun/ldmvsw.c
> @@ -287,6 +287,9 @@ static int vsw_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
>  
>  	hp = mdesc_grab();
>  
> +	if (!hp)
> +		return -ENODEV;
> +
>  	rmac = mdesc_get_property(hp, vdev->mp, remote_macaddr_prop, &len);
>  	err = -ENODEV;
>  	if (!rmac) {
> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index fe86fbd58586..e220620d0ffc 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
> @@ -433,6 +433,9 @@ static int vnet_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
>  
>  	hp = mdesc_grab();
>  
> +	if (!hp)
> +		return -ENODEV;
> +
>  	vp = vnet_find_parent(hp, vdev->mp, vdev);
>  	if (IS_ERR(vp)) {
>  		pr_err("Cannot find port parent vnet\n");
> -- 
> 2.25.1
> 
Perfectly valid checks, thanks.
Reviewed-by: Piotr Raczynski <piotr.raczynski@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ