diff options
author | Thierry Escande <thierry.escande@linaro.org> | 2019-02-15 10:40:07 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-19 14:50:11 +0100 |
commit | 7c11df42d0c7bf5b3dd743a21b4872e7b26ca2a2 (patch) | |
tree | 7c41fcba92c303c772a30a32712e07eda5f59e3c /drivers | |
parent | c0fae22f4863731ffad01513034b4b019f64004f (diff) | |
download | linux-stable-7c11df42d0c7bf5b3dd743a21b4872e7b26ca2a2.tar.gz linux-stable-7c11df42d0c7bf5b3dd743a21b4872e7b26ca2a2.tar.bz2 linux-stable-7c11df42d0c7bf5b3dd743a21b4872e7b26ca2a2.zip |
misc: fastrpc: Fix device_open when no session is available
This change fixes fastrpc_device_open() when no session is available and
return an error in such case.
Signed-off-by: Thierry Escande <thierry.escande@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/fastrpc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4b0db33896df..89aec17738ef 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1016,10 +1016,19 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) INIT_LIST_HEAD(&fl->user); fl->tgid = current->tgid; fl->cctx = cctx; + + fl->sctx = fastrpc_session_alloc(cctx); + if (!fl->sctx) { + dev_err(&cctx->rpdev->dev, "No session available\n"); + mutex_destroy(&fl->mutex); + kfree(fl); + + return -EBUSY; + } + spin_lock(&cctx->lock); list_add_tail(&fl->user, &cctx->users); spin_unlock(&cctx->lock); - fl->sctx = fastrpc_session_alloc(cctx); return 0; } |