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: <73d2002a-9afa-4cfd-b835-6908d64586d6@app.fastmail.com>
Date: Thu, 20 Jun 2024 13:40:23 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Peter Griffin" <peter.griffin@...aro.org>, "Lee Jones" <lee@...nel.org>,
 "Krzysztof Kozlowski" <krzk@...nel.org>,
 "Alim Akhtar" <alim.akhtar@...sung.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-samsung-soc@...r.kernel.org,
 linux-kernel@...r.kernel.org, "Tudor Ambarus" <tudor.ambarus@...aro.org>,
 André Draszik <andre.draszik@...aro.org>,
 "Saravana Kannan" <saravanak@...gle.com>,
 "William McVicker" <willmcvicker@...gle.com>,
 "Sam Protsenko" <semen.protsenko@...aro.org>, kernel-team@...roid.com
Subject: Re: [PATCH v2 1/2] mfd: syscon: add of_syscon_register_regmap() API


On Thu, Jun 20, 2024, at 13:24, Peter Griffin wrote:
> Signed-off-by: Peter Griffin <peter.griffin@...aro.org>
> Reviewed-by: Arnd Bergmann <arnd@...db.de>
> Reviewed-by: Sam Protsenko <semen.protsenko@...aro.org>
> ---
> Changes in v2:
> - Keep syscon lock held between checking and adding entry (Krzysztof)

Unfortunately you now have a different bug:

> +	/* check if syscon entry already exists */
> +	spin_lock(&syscon_list_slock);
> +
> +	list_for_each_entry(entry, &syscon_list, list)
> +		if (entry->np == np) {
> +			syscon = entry;
> +			break;
> +		}
> +
> +	if (syscon) {
> +		ret = -EEXIST;
> +		goto err_unlock;
> +	}
> +
> +	syscon = kzalloc(sizeof(*syscon), GFP_KERNEL);
> +	if (!syscon) {
> +		ret = -ENOMEM;
> +		goto err_unlock;
> +	}

You can't use GFP_KERNEL while holding a spinlock.

I think the correct way to do this is to move the allocation
before the locked section, and then free it in the failure case.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ