sdm660: ADSPRPC: Null check file session ctx during mmap create

During fastrpc mmap create and mmap free, we are dereferencing
file session context without checking for Null.

Change-Id: I65fc2bb566e2e6e7914b86044e17577a96db6b4f
Acked-by: Vishnu Karthik D <vikarthi@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
This commit is contained in:
Tharun Kumar Merugu 2017-03-22 16:28:40 +05:30 committed by Gerrit - the friendly Code Review server
parent 630218f710
commit 3c2b633bb9

View file

@ -553,7 +553,7 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map)
if (!IS_ERR_OR_NULL(map->handle)) if (!IS_ERR_OR_NULL(map->handle))
ion_free(fl->apps->client, map->handle); ion_free(fl->apps->client, map->handle);
if (sess->smmu.enabled) { if (sess && sess->smmu.enabled) {
if (map->size || map->phys) if (map->size || map->phys)
msm_dma_unmap_sg(sess->smmu.dev, msm_dma_unmap_sg(sess->smmu.dev,
map->table->sgl, map->table->sgl,
@ -645,6 +645,9 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd, unsigned attr,
else else
sess = fl->sctx; sess = fl->sctx;
VERIFY(err, !IS_ERR_OR_NULL(sess));
if (err)
goto bail;
VERIFY(err, !IS_ERR_OR_NULL(map->buf = dma_buf_get(fd))); VERIFY(err, !IS_ERR_OR_NULL(map->buf = dma_buf_get(fd)));
if (err) if (err)
goto bail; goto bail;