Commit 41db5f83 authored by Jorge Ramirez-Ortiz's avatar Jorge Ramirez-Ortiz Committed by Greg Kroah-Hartman
Browse files

misc: fastrpc: fix memory leak when out of memory

parent 0854d589
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -279,8 +279,11 @@ static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev,

	buf->virt = dma_alloc_coherent(dev, buf->size, (dma_addr_t *)&buf->phys,
				       GFP_KERNEL);
	if (!buf->virt)
	if (!buf->virt) {
		mutex_destroy(&buf->lock);
		kfree(buf);
		return -ENOMEM;
	}

	if (fl->sctx && fl->sctx->sid)
		buf->phys += ((u64)fl->sctx->sid << 32);