]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
remoteproc: Fix potential race condition in rproc_add
authorDave Gerlach <d-gerlach@ti.com>
Wed, 25 May 2016 20:41:28 +0000 (15:41 -0500)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 14 Jun 2016 18:08:16 +0000 (11:08 -0700)
commitd2e12e66a939c54ed84e5f1b6947f0c45f6c56eb
tree69abbfbbedb22a33325de5aac867c77daea8c167
parent15ebc72dbad17cf85b006f111f5ba604ab52deb6
remoteproc: Fix potential race condition in rproc_add

rproc_add adds the newly created remoteproc to a list for use by
rproc_get_by_phandle and then does some additional processing to finish
adding the remoteproc. This leaves a small window of time in which the
rproc is available in the list but not yet fully initialized, so if
another driver comes along and gets a handle to the rproc, it will be
invalid. Rearrange the code in rproc_add to make sure the rproc is added
to the list only after it has been successfuly initialized.

Fixes: fec47d863587 ("remoteproc: introduce rproc_get_by_phandle API")
Cc: stable@vger.kernel.org
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/remoteproc/remoteproc_core.c