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:   Tue, 22 Oct 2019 11:40:38 +0200
From:   Markus Elfring <Markus.Elfring@....de>
To:     Navid Emamdoost <navid.emamdoost@...il.com>,
        Thierry Reding <treding@...dia.com>,
        Gerd Hoffmann <kraxel@...hat.com>,
        Ben Skeggs <bskeggs@...hat.com>, nouveau@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Navid Emamdoost <emamd001@....edu>, Kangjie Lu <kjlu@....edu>,
        Stephen McCamant <smccaman@....edu>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...ux.ie>
Subject: Re: [PATCH] drm/nouveau: Fix memory leak in nouveau_bo_alloc

> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -276,8 +276,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 flags,
>  			break;
>  	}
>
> -	if (WARN_ON(pi < 0))
> +	if (WARN_ON(pi < 0)) {
> +		kfree(nvbo);
>  		return ERR_PTR(-EINVAL);
> +	}
>
>  	/* Disable compression if suitable settings couldn't be found. */
>  	if (nvbo->comp && !vmm->page[pi].comp) {

This addition looks correct.
But I would prefer to move such exception handling code to the end of
this function implementation so that duplicate source code will be reduced.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=7d194c2100ad2a6dded545887d02754948ca5241#n450

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ