diff options
author | Gaurav Sarode <gsarode@nvidia.com> | 2011-07-15 15:51:57 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-07-15 16:50:34 -0700 |
commit | cddc2f824cbce533c1d8229e1cc29a212370f2cc (patch) | |
tree | 512a03a58e7507854d4dcafe8c0711b68f5360ed | |
parent | 7391b685365f8b1dc8c1477c6b3507007567991c (diff) |
video: tegra: dc: Fix wrong handling of dc enable.
DC reset disables dc for sometime. If IOCTL_FLIP
occurs during that time then wrong status will be reported.
Add dc mutex around dc->enable to prevent wrong value read.
Fix bug 852345
Change-Id: I27674abc45fca6bed061f7d34e1454235458fc1c
Reviewed-on: http://git-master/r/41201
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r-- | drivers/video/tegra/dc/overlay.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/video/tegra/dc/overlay.c b/drivers/video/tegra/dc/overlay.c index 19e04a2df92c..d4bdea924612 100644 --- a/drivers/video/tegra/dc/overlay.c +++ b/drivers/video/tegra/dc/overlay.c @@ -342,10 +342,13 @@ static int tegra_overlay_flip(struct tegra_overlay_info *overlay, return -EFAULT; mutex_lock(&tegra_flip_lock); + mutex_lock(&overlay->dc->lock); if (!overlay->dc->enabled) { + mutex_unlock(&overlay->dc->lock); mutex_unlock(&tegra_flip_lock); return -EFAULT; } + mutex_unlock(&overlay->dc->lock); data = kzalloc(sizeof(*data), GFP_KERNEL); if (data == NULL) { @@ -511,11 +514,16 @@ static int tegra_overlay_ioctl_flip(struct overlay_client *client, { int i = 0; int idx = 0; + int err; bool found_one = false; struct tegra_overlay_flip_args flip_args; - if (!client->dev->dc->enabled) + mutex_lock(&client->dev->dc->lock); + if (!client->dev->dc->enabled) { + mutex_unlock(&client->dev->dc->lock); return -EPIPE; + } + mutex_unlock(&client->dev->dc->lock); if (copy_from_user(&flip_args, arg, sizeof(flip_args))) return -EFAULT; @@ -549,7 +557,10 @@ static int tegra_overlay_ioctl_flip(struct overlay_client *client, if (!found_one) return -EFAULT; - tegra_overlay_flip(client->dev, &flip_args, client->user_nvmap); + err = tegra_overlay_flip(client->dev, &flip_args, client->user_nvmap); + + if (err) + return err; if (copy_to_user(arg, &flip_args, sizeof(flip_args))) return -EFAULT; |