From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, vkoul@kernel.org
Cc: yung-chuan.liao@linux.intel.com, sanyog.r.kale@intel.com,
guennadi.liakhovetski@linux.intel.com, rander.wang@intel.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] soundwire: bus: stop dereferencing invalid slave pointer
Date: Tue, 12 Oct 2021 08:32:35 -0500 [thread overview]
Message-ID: <cb1d0d1d-100f-48b7-f809-7c84148ae0ba@linux.intel.com> (raw)
In-Reply-To: <20211012101521.32087-1-srinivas.kandagatla@linaro.org>
On 10/12/21 5:15 AM, Srinivas Kandagatla wrote:
> Slave pointer is invalid after end of list iteration, using this
> would result in below Memory abort.
>
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
> ...
> Call trace:
> __dev_printk+0x34/0x7c
> _dev_warn+0x6c/0x90
> sdw_bus_exit_clk_stop+0x194/0x1d0
> swrm_runtime_resume+0x13c/0x238
> pm_generic_runtime_resume+0x2c/0x48
> __rpm_callback+0x44/0x150
> rpm_callback+0x6c/0x78
> rpm_resume+0x314/0x558
> rpm_resume+0x378/0x558
> rpm_resume+0x378/0x558
> __pm_runtime_resume+0x3c/0x88
>
> Use bus->dev instead to print this error message.
>
> Fixes: b50bb8ba369cd ("soundwire: bus: handle -ENODATA errors in clock stop/start sequences")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Nice catch, even if the 'slave' pointer was valid it makes no sense to
use this device for a bus-level operation. Using the bus->dev is the
right thing to do.
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> drivers/soundwire/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index 1b115734a8f6..67369e941d0d 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -1110,7 +1110,7 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus)
> if (!simple_clk_stop) {
> ret = sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM);
> if (ret < 0)
> - dev_warn(&slave->dev, "clock stop deprepare wait failed:%d\n", ret);
> + dev_warn(bus->dev, "clock stop deprepare wait failed:%d\n", ret);
> }
>
> list_for_each_entry(slave, &bus->slaves, node) {
>
next prev parent reply other threads:[~2021-10-12 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 10:15 Srinivas Kandagatla
2021-10-12 13:32 ` Pierre-Louis Bossart [this message]
2021-10-20 15:24 ` Vinod Koul
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=cb1d0d1d-100f-48b7-f809-7c84148ae0ba@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rander.wang@intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.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
all inboxes | Powered by JetHome®