]> git.baikalelectronics.ru Git - kernel.git/commit
remoteproc: core: Move state checking to remoteproc_core
authorShengjiu Wang <shengjiu.wang@nxp.com>
Mon, 28 Mar 2022 02:20:12 +0000 (10:20 +0800)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Thu, 14 Apr 2022 17:13:33 +0000 (11:13 -0600)
commita879483c4946fa431abeda7762da7c3af81726f2
tree3775198a18e92b4de73c50d493a1c6b2ad193c5c
parent0ae0f0156414787ee5a03ba374d86d12ecafbedb
remoteproc: core: Move state checking to remoteproc_core

There is no mutex protection of these state checking for 'stop'
and 'detach' which can't guarantee there is no another instance
is trying to do same operation.

Consider two instances case:
Instance1: echo stop > /sys/class/remoteproc/remoteproc0/state
Instance2: echo stop > /sys/class/remoteproc/remoteproc0/state

The issue is that the instance2 case may success, Or it
may fail with -EINVAL, which is uncertain.

So move this state checking in rproc_cdev_write() and
state_store() for 'stop', 'detach' operation to
'rproc_shutdown' , 'rproc_detach' function under the mutex
protection.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1648434012-16655-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/remoteproc/remoteproc_cdev.c
drivers/remoteproc/remoteproc_core.c
drivers/remoteproc/remoteproc_sysfs.c