• Loic Pallardy's avatar
    remoteproc: fix vdev reference management · c81c0e07
    Loic Pallardy authored
    Commit 2b45cef5 ("remoteproc: Further extend the vdev life cycle")
    extends kref support for vdev management.
    It introduces a regression when following sequence is executed:
    rproc_boot --> rproc_shutdown --> rproc_boot
    Second rproc_boot call crashes on register_virtio_device as device
    is already existing.
    Issue is previous vdev is never released when rproc is stop because
    associated refcount is too high.
    
    kref_get introduces is not needed as kref_init already initializes
    krefcount to 1 because it considers associated variable as used.
    This introduces a misalignment between kref_get and kref_put calls.
    
    Fixes: 2b45cef5 ("remoteproc: Further extend the vdev life cycle")
    Signed-off-by: default avatarLoic Pallardy <loic.pallardy@st.com>
    Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
    c81c0e07
remoteproc_core.c 42.2 KB