From: Yonghao Zhang <hyz3367@gmail.com>
To: mathieu.poirier@linaro.org, andersson@kernel.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
Yonghao Zhang <hyz3367@gmail.com>
Subject: [PATCH v2 3/4] remoteproc: core: Guard against a missing stop() in the attach unwind
Date: Tue, 24 Nov 2026 15:14:08 +0800 [thread overview]
Message-ID: <20261124071409.972-4-hyz3367@gmail.com> (raw)
In-Reply-To: <20261124071409.972-1-hyz3367@gmail.com>
When the subdevice registration fails after a successful ops->attach(),
__rproc_attach() unrolls with an unconditional ops->stop() call: an
implementation without stop() turns that error path into a NULL
dereference.
An attach-only implementation, such as commit 1168af40b1ad ("remoteproc:
k3-r5: Add support for IPC-only mode for all R5Fs"), has no stop() and
can reach that path. Skip the rollback call when there is no stop():
with nothing to roll the attach back with, the processor stays running
and the failure is reported by the attach attempt itself.
Fixes: d848a4819d85 ("remoteproc: Introducing function rproc_attach()")
Signed-off-by: Yonghao Zhang <hyz3367@gmail.com>
---
drivers/remoteproc/remoteproc_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index e44b45510b4e..8c3fc85b8f04 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1357,7 +1357,10 @@ static int __rproc_attach(struct rproc *rproc)
if (ret) {
dev_err(dev, "failed to probe subdevices for %s: %d\n",
rproc->name, ret);
- goto stop_rproc;
+ if (rproc->ops->stop)
+ goto stop_rproc;
+ dev_err(dev, "can't roll %s back: no stop()\n", rproc->name);
+ goto unprepare_subdevices;
}
rproc->state = RPROC_ATTACHED;
--
2.34.1
next prev parent reply other threads:[~2026-11-24 7:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 7:14 [PATCH v2 0/4] remoteproc: core: Fix the error unwind paths Yonghao Zhang
2026-11-24 7:14 ` [PATCH v2 1/4] remoteproc: core: Reset freed vring entries to FW_RSC_ADDR_ANY Yonghao Zhang
2026-11-24 7:14 ` [PATCH v2 2/4] remoteproc: core: Guard against a missing stop() in rproc_start() Yonghao Zhang
2026-11-24 7:14 ` Yonghao Zhang [this message]
2026-11-24 7:14 ` [PATCH v2 4/4] remoteproc: core: Clean up after a failed recovery Yonghao Zhang
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=20261124071409.972-4-hyz3367@gmail.com \
--to=hyz3367@gmail.com \
--cc=andersson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.