Discuss SCMI firmware, SCMI drivers in Linux, U-boot, OP-TEE
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, arm-scmi@vger.kernel.org
Subject: Re: [PATCH] firmware: arm_scmi: fix an OF node reference leak in scmi_txrx_setup()
Date: Tue, 17 Dec 2024 11:50:27 +0100	[thread overview]
Message-ID: <4c4d130b-3fd0-4339-a005-23472c82625a@kernel.org> (raw)
In-Reply-To: <77ed017b-c5c9-4a41-aaf5-e0447c102260@stanley.mountain>

On 17/12/2024 06:51, Dan Carpenter wrote:
> On Tue, Dec 17, 2024 at 11:31:22AM +0900, Joe Hattori wrote:
>> scmi_txrx_setup() calls scmi_chan_setup(), which increments the refcount
>> of the given OF node. When the Rx channel setup fails with ENOMEM,
>> scmi_chan_setup() returns the error, but does not release the OF node
>> obtained in the Tx channel setup. Thus, add an of_node_put() call when
>> the Rx setup fails with ENOMEM.
>>
>> This bug was found by an experimental static analysis tool that I am
>> developing.
>>
> 
> No, the patch is wrong.
> 
There are more patches like this without understanding the OF
drop/retain reference behavior. I suggest careful review of all results
of this "static analysis tool".

Best regards,
Krzysztof

  reply	other threads:[~2024-12-17 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17  2:31 [PATCH] firmware: arm_scmi: fix an OF node reference leak in scmi_txrx_setup() Joe Hattori
2024-12-17  5:51 ` Dan Carpenter
2024-12-17 10:50   ` Krzysztof Kozlowski [this message]
2024-12-17 14:27     ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c4d130b-3fd0-4339-a005-23472c82625a@kernel.org \
    --to=krzk@kernel.org \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=dan.carpenter@linaro.org \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox