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: <20240414103926.GB645060@kernel.org>
Date: Sun, 14 Apr 2024 11:39:26 +0100
From: Simon Horman <horms@...nel.org>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Marcel Holtmann <marcel@...tmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@...il.com>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>, Kalle Valo <kvalo@...nel.org>,
	Bjorn Andersson <andersson@...nel.org>,
	Konrad Dybcio <konrad.dybcio@...aro.org>,
	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
	Saravana Kannan <saravanak@...gle.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Arnd Bergmann <arnd@...db.de>,
	Neil Armstrong <neil.armstrong@...aro.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Alex Elder <elder@...aro.org>,
	Srini Kandagatla <srinivas.kandagatla@...aro.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Abel Vesa <abel.vesa@...aro.org>,
	Manivannan Sadhasivam <mani@...nel.org>,
	Lukas Wunner <lukas@...ner.de>,
	Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
	Amit Pundir <amit.pundir@...aro.org>,
	Xilin Wu <wuxilin123@...il.com>, linux-bluetooth@...r.kernel.org,
	netdev@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
	linux-arm-msm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-pci@...r.kernel.org, linux-pm@...r.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v7 13/16] power: sequencing: implement the pwrseq core

On Wed, Apr 10, 2024 at 02:46:25PM +0200, Bartosz Golaszewski wrote:

...

> +/**
> + * pwrseq_device_register() - Register a new power sequencer.
> + * @config: Configuration of the new power sequencing device.
> + *
> + * The config structure is only used during the call and can be freed after
> + * the function returns. The config structure *must* have the parent device
> + * as well as the match() callback and at least one target set.
> + *
> + * Returns:
> + * Returns the address of the new pwrseq device or ERR_PTR() on failure.
> + */
> +struct pwrseq_device *
> +pwrseq_device_register(const struct pwrseq_config *config)
> +{
> +	struct pwrseq_device *pwrseq;
> +	int ret;
> +
> +	if (!config->parent || !config->match || !config->targets ||
> +	    !config->targets[0])
> +		return ERR_PTR(-EINVAL);
> +
> +	pwrseq = kzalloc(sizeof(*pwrseq), GFP_KERNEL);
> +	if (!pwrseq)
> +		return ERR_PTR(-ENOMEM);
> +
> +	pwrseq->dev.type = &pwrseq_device_type;
> +	pwrseq->dev.bus = &pwrseq_bus;
> +	pwrseq->dev.parent = config->parent;
> +	device_set_node(&pwrseq->dev, dev_fwnode(config->parent));
> +	dev_set_drvdata(&pwrseq->dev, config->drvdata);
> +
> +	pwrseq->id = ida_alloc(&pwrseq_ida, GFP_KERNEL);
> +	if (pwrseq->id < 0) {
> +		kfree(pwrseq);

Hi Bartosz,

pwrseq is freed on the line above,
so it should not be dereferenced on the line below.

Flagged by Smatch.

> +		return ERR_PTR(pwrseq->id);
> +	}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ