]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.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)
committerKamal Mostafa <kamal@canonical.com>
Mon, 22 Aug 2016 14:42:25 +0000 (07:42 -0700)
commitd049239e9e4edeb83ab4b419509aa4738123d671
treefcb3dea4c29a32f6d9bdc96f7dd875d8c2842728
parent93bd8a95d3ed1864eebe62b66a24a8f7bc190f2f
remoteproc: Fix potential race condition in rproc_add

BugLink: http://bugs.launchpad.net/bugs/1615620
commit d2e12e66a939c54ed84e5f1b6947f0c45f6c56eb upstream.

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")
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/remoteproc/remoteproc_core.c