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: <d90c0678-d2ed-4e77-901a-fdbab7dfca71@web.de>
Date: Sun, 16 Mar 2025 13:05:08 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Dan Carpenter <dan.carpenter@...aro.org>, linux-riscv@...ts.infradead.org
Cc: kernel-janitors@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
 Drew Fustini <drew@...7.com>, Fu Wei <wefu@...hat.com>,
 Guo Ren <guoren@...nel.org>, Michal Wilczynski <m.wilczynski@...sung.com>,
 Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH next] firmware: thead,th1520-aon: Fix use after free in
 th1520_aon_init()

> Record the error code before freeing "aon_chan" to avoid a
> use after free.

Would it become helpful to mention which selection of source code
analysis tools detected such a questionable implementation detail?


…
> +++ b/drivers/firmware/thead,th1520-aon.c
> @@ -203,6 +203,7 @@ struct th1520_aon_chan *th1520_aon_init(struct device *dev)
>  {
>  	struct th1520_aon_chan *aon_chan;
>  	struct mbox_client *cl;
> +	int ret;
>
>  	aon_chan = kzalloc(sizeof(*aon_chan), GFP_KERNEL);
>  	if (!aon_chan)
> @@ -217,8 +218,9 @@ struct th1520_aon_chan *th1520_aon_init(struct device *dev)
>  	aon_chan->ch = mbox_request_channel_byname(cl, "aon");
>  	if (IS_ERR(aon_chan->ch)) {
>  		dev_err(dev, "Failed to request aon mbox chan\n");
> +		ret = PTR_ERR(aon_chan->ch);
>  		kfree(aon_chan);
> -		return ERR_CAST(aon_chan->ch);
> +		return ERR_PTR(ret);
>  	}
>
>  	mutex_init(&aon_chan->transaction_lock);

May the additional variable (for an information) be defined only for
the affected if branch?
Would a smaller scope be more appropriate here?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ