summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/dev.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2011-09-22 15:37:17 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:49:23 -0800
commit601e1d16240cbe24c6d4fa72c6afacfbde13022e (patch)
treec33ece0e7705e7fd995118ac03ef5393d8b9c094 /drivers/video/tegra/host/dev.c
parentbb210ce4aeb7ba7455f03938c6d4c87f9f1e2cad (diff)
video: tegra: host: Check for allocation failures
Adds checks for memory allocation failures, and proper propagation of error conditions. Adds clearing of pointers after free or unpin has been called to catch use after free. Bug 877551 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/54027 Reviewed-by: Antti Miettinen <amiettinen@nvidia.com> Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Gerrit_Virtual_Submit (cherry picked from commit bfbf2766d11a5f85781532ddce3a87b7ae762ba3) Change-Id: I04171ee5db6a42bb1689221d4f80d5f3d35e7399 Reviewed-on: http://git-master/r/57462 Rebase-Id: Rc9f43312c8b818869d746f4b73700d8b56e4569d
Diffstat (limited to 'drivers/video/tegra/host/dev.c')
-rw-r--r--drivers/video/tegra/host/dev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c
index 020521904495..ce963c864503 100644
--- a/drivers/video/tegra/host/dev.c
+++ b/drivers/video/tegra/host/dev.c
@@ -132,6 +132,8 @@ static int nvhost_channelopen(struct inode *inode, struct file *filp)
}
priv->gathers = nvmap_mmap(priv->gather_mem);
+ if (!priv->gathers)
+ goto fail;
return 0;
fail:
@@ -703,7 +705,7 @@ static void power_on_host(struct nvhost_module *mod)
nvhost_intr_start(&dev->intr, clk_get_rate(mod->clk[0]));
}
-static void power_off_host(struct nvhost_module *mod)
+static int power_off_host(struct nvhost_module *mod)
{
struct nvhost_master *dev =
container_of(mod, struct nvhost_master, mod);
@@ -713,6 +715,7 @@ static void power_off_host(struct nvhost_module *mod)
nvhost_channel_suspend(&dev->channels[i]);
nvhost_syncpt_save(&dev->syncpt);
nvhost_intr_stop(&dev->intr);
+ return 0;
}
static int __devinit nvhost_user_init(struct nvhost_master *host)