* Re: [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc()
@ 2020-04-14 8:24 Markus Elfring
2020-04-14 12:27 ` Alex Elder
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-04-14 8:24 UTC (permalink / raw)
To: Mathieu Poirier, Alex Elder, linux-remoteproc
Cc: linux-kernel, Bjorn Andersson, Ohad Ben-Cohen, Suman Anna
> I'm not actually sure this case causes an observable problem, but
> it's incorrect. Fix this by initializing the notifyids field before
> calling ida_simple_get() in rproc_alloc().
I suggest to improve the commit message.
* Can the information “field initialisation” be more helpful than “bug”
in the patch subject?
* Will the tag “Fixes” become relevant?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc()
2020-04-14 8:24 [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc() Markus Elfring
@ 2020-04-14 12:27 ` Alex Elder
0 siblings, 0 replies; 3+ messages in thread
From: Alex Elder @ 2020-04-14 12:27 UTC (permalink / raw)
To: Markus Elfring, Mathieu Poirier, linux-remoteproc
Cc: linux-kernel, Bjorn Andersson, Ohad Ben-Cohen, Suman Anna
On 4/14/20 3:24 AM, Markus Elfring wrote:
>> I'm not actually sure this case causes an observable problem, but
>> it's incorrect. Fix this by initializing the notifyids field before
>> calling ida_simple_get() in rproc_alloc().
>
> I suggest to improve the commit message.
>
> * Can the information “field initialisation” be more helpful than “bug”
> in the patch subject?
No objection, though I personally would have spelled it
differently :)
> * Will the tag “Fixes” become relevant?
This bug was present when this code was first added.
Fixes: b5ab5e24e960 ("remoteproc: maintain a generic child device for each rproc")
Mathiew, feel free to add that.
-Alex
> Regards,
> Markus
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 0/4] remoteproc: Refactor function rproc_alloc()
@ 2020-04-13 19:33 Mathieu Poirier
2020-04-13 19:33 ` [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc() Mathieu Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2020-04-13 19:33 UTC (permalink / raw)
To: bjorn.andersson, ohad; +Cc: s-anna, elder, linux-remoteproc, linux-kernel
Hi Bjorn,
Function rproc_alloc() had to be reworked as part of my work on MCU
synchronisation[1]. Concurrent to that Suman [2] and Alex [3] also did
some work on the same function.
In order to provide a clean foundation for everyone to work from and avoid
unpleasant merge conflicts this set gathers the work that both Alex and I
did. That way Suman and I can move forward with our respective patchsets
without too much headache.
Applies cleanly on v5.7-rc1.
Thanks,
Mathieu
[1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=261069
[2]. https://patchwork.kernel.org/patch/11456385/
[3]. https://patchwork.kernel.org/patch/11473241/
Alex Elder (1):
remoteproc: Fix a bug in rproc_alloc()
Mathieu Poirier (3):
remoteproc: Split firmware name allocation from rproc_alloc()
remoteproc: Split rproc_ops allocation from rproc_alloc()
remoteproc: Get rid of tedious error path
drivers/remoteproc/remoteproc_core.c | 101 +++++++++++++++------------
1 file changed, 58 insertions(+), 43 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc()
2020-04-13 19:33 [PATCH 0/4] remoteproc: Refactor function rproc_alloc() Mathieu Poirier
@ 2020-04-13 19:33 ` Mathieu Poirier
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Poirier @ 2020-04-13 19:33 UTC (permalink / raw)
To: bjorn.andersson, ohad; +Cc: s-anna, elder, linux-remoteproc, linux-kernel
From: Alex Elder <elder@linaro.org>
If ida_simple_get() returns an error when called in rproc_alloc(),
put_device() is called to clean things up. By this time the rproc
device type has been assigned, with rproc_type_release() as the
release function.
The first thing rproc_type_release() does is call:
idr_destroy(&rproc->notifyids);
But at the time the ida_simple_get() call is made, the notifyids
field in the remoteproc structure has not been initialized.
I'm not actually sure this case causes an observable problem, but
it's incorrect. Fix this by initializing the notifyids field before
calling ida_simple_get() in rproc_alloc().
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/remoteproc/remoteproc_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index e12a54e67588..80056513ae71 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2053,6 +2053,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
rproc->dev.type = &rproc_type;
rproc->dev.class = &rproc_class;
rproc->dev.driver_data = rproc;
+ idr_init(&rproc->notifyids);
/* Assign a unique device index and name */
rproc->index = ida_simple_get(&rproc_dev_index, 0, 0, GFP_KERNEL);
@@ -2078,8 +2079,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
mutex_init(&rproc->lock);
- idr_init(&rproc->notifyids);
-
INIT_LIST_HEAD(&rproc->carveouts);
INIT_LIST_HEAD(&rproc->mappings);
INIT_LIST_HEAD(&rproc->traces);
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-14 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 8:24 [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc() Markus Elfring
2020-04-14 12:27 ` Alex Elder
-- strict thread matches above, loose matches on Subject: below --
2020-04-13 19:33 [PATCH 0/4] remoteproc: Refactor function rproc_alloc() Mathieu Poirier
2020-04-13 19:33 ` [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc() Mathieu Poirier
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®