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]
Date:   Thu, 27 May 2021 13:36:41 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Richard Gong <richard.gong@...ux.intel.com>
Cc:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        gregkh@...uxfoundation.org, atull@...nel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] firmware: stratix10-svc: Fix a resource leak in an error
 handling path

On Wed, May 26, 2021 at 02:13:12PM -0500, Richard Gong wrote:
> >   	dev_set_drvdata(dev, svc);
> >   	pr_info("Intel Service Layer Driver Initialized\n");
> > +	return 0;
> > +
> > +err_put_device:
> > +	platform_device_put(svc->stratix10_svc_rsu);
> > +err_free_kfifo:
> > +	kfifo_free(&controller->svc_fifo);
> 
> Need for the allocated memory pool as well,
> 	if (ctrl->genpool)
>                 gen_pool_destroy(ctrl->genpool);
> 

Good point, but there is no need to check, the genpool is not optional
and the "if (ctrl->genpool)" condition could be deleted from the remove
function as well.

err_put_device:
	platform_device_put(svc->stratix10_svc_rsu);
err_free_kfifo:
	kfifo_free(&controller->svc_fifo);
err_destroy_pool:
	gen_pool_destroy(genpool);

	return ret;

But the other question is what's on with the &svc_ctrl list?  I would
have thought that we needed to remove freed controller from the list as
well, but looking at it now I think the list itself should be removed.
I think there can only be one item in the list at a time.  So we could
just make the controller pointer a file scope global or we could find
some other way to go from the client pointer to the controller pointer.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ