From: Dan Carpenter <dan.carpenter@linaro.org>
To: daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org
Subject: [bug report] thermal/debugfs: Add thermal cooling device debugfs information
Date: Fri, 12 Jan 2024 11:13:00 +0300 [thread overview]
Message-ID: <ddde68fc-8693-42bd-bcff-c9ddbd1215c2@moroto.mountain> (raw)
Hello Daniel Lezcano,
The patch 90f2fb4afe8b: "thermal/debugfs: Add thermal cooling device
debugfs information" from Jan 9, 2024 (linux-next), leads to the
following Smatch static checker warning:
drivers/thermal/thermal_debugfs.c:517 thermal_debug_cdev_remove() warn: 'thermal_dbg' was already freed. (line 515)
drivers/thermal/thermal_debugfs.c:835 thermal_debug_tz_remove() warn: 'thermal_dbg' was already freed. (line 833)
drivers/thermal/thermal_debugfs.c
504 void thermal_debug_cdev_remove(struct thermal_cooling_device *cdev)
505 {
506 struct thermal_debugfs *thermal_dbg = cdev->debugfs;
507
508 if (!thermal_dbg)
509 return;
510
511 mutex_lock(&thermal_dbg->lock);
512
513 thermal_debugfs_cdev_clear(&thermal_dbg->cdev_dbg);
514 cdev->debugfs = NULL;
515 thermal_debugfs_remove_id(thermal_dbg);
^^^^^^^^^^^
Freed here.
516
--> 517 mutex_unlock(&thermal_dbg->lock);
^^^^^^^^^^^^^^^^^^
Use after free. Same issue in the tz remove() function.
518 }
regards,
dan carpenter
next reply other threads:[~2024-01-12 8:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 8:13 Dan Carpenter [this message]
2024-01-12 14:50 ` [bug report] thermal/debugfs: Add thermal cooling device debugfs information Rafael J. Wysocki
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=ddde68fc-8693-42bd-bcff-c9ddbd1215c2@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-pm@vger.kernel.org \
/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