summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Sarode <gsarode@nvidia.com>2011-07-15 15:51:57 +0530
committerCheryl Jones <chjones@nvidia.com>2011-08-26 18:23:15 -0700
commit76faa72117f9848326356f7edc7abe8799a8f59d (patch)
tree4d269a358347c26af6917464607506ad5eef9973
parent5537288a3faf4ba7b6677dab8790a022d06d638b (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 Bug 863528 Bug 863828 Reviewed-on: http://git-master/r/47539 (cherry picked from commit 8a703e95f4b1bd013f2065634836d7a719bbfb98) Change-Id: I4854bd8a513ceb854d6d54b96f4f38afc3a63008 Reviewed-on: http://git-master/r/49140 Reviewed-by: Youngjin Kim <nkim@nvidia.com> Tested-by: Youngjin Kim <nkim@nvidia.com> Reviewed-by: Bo Kim <bok@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/overlay.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/video/tegra/dc/overlay.c b/drivers/video/tegra/dc/overlay.c
index b40f8470373e..c5d293dacca4 100644
--- a/drivers/video/tegra/dc/overlay.c
+++ b/drivers/video/tegra/dc/overlay.c
@@ -341,10 +341,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) {
@@ -509,11 +512,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;
@@ -547,7 +555,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;