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]
Date:	Wed, 12 Aug 2015 11:11:39 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Viresh Kumar <viresh.kumar@...aro.org>
Cc:	Rafael Wysocki <rjw@...ysocki.net>, nm@...com,
	sboyd@...eaurora.org, linaro-kernel@...ts.linaro.org,
	linux-pm@...r.kernel.org, khilman@...aro.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Len Brown <len.brown@...el.com>,
	open list <linux-kernel@...r.kernel.org>,
	Pavel Machek <pavel@....cz>
Subject: Re: [PATCH V2 1/6] PM / OPP: Free resources and properly return
 error on failure

On Wed, Aug 12, 2015 at 12:13:09PM +0530, Viresh Kumar wrote:
> > If the first call to _opp_add_static_v2() fails we call
> > of_free_opp_table() and you say that triggers a WARN().
> 
> No it doesn't.
> 
> So, coming back to the point you made about freeing table on !count,
> because there were no nodes present in the DT opp table, we have never
> tried to add any OPPs. And so there is no need to call
> of_free_opp_table() in that case.
> 
> Do you still think the current code is wrong ?

If it doesn't WARN() then it's not buggy, but it's still ugly.  We
should not call of_free_opp_table() because we *tried* to add an OPP, we
should only call it if we *succeeded*.

The way the code is written and from your emails I was afraid that if
you tried to call _opp_add_static_v2() and it fails then it leaves
artifacts lying around that need to be cleaned up by the caller.  This
would be the ugliest scenario.  But I looked at _opp_add_static_v2()
and looks fine.  It cleans up properly on failure.  We only need to
clean up if it succeeds.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ