]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Fix race in sync dump
authorArto Merilainen <amerilainen@nvidia.com>
Fri, 9 May 2014 08:38:25 +0000 (11:38 +0300)
committerRiham Haidar <rhaidar@nvidia.com>
Mon, 12 May 2014 18:52:36 +0000 (11:52 -0700)
The code assumed that the sync framework will not call nvhost
specific functions until the pointer has been returned to
the caller. In most cases this is a fair assumption, however,
if the sync dump was in progress at the same time we created a
new fence, we may try to print out fence specific data before
it has been created.

This function adds necessary check to nvhost_sync_pt_value_str()
which is the only function suffering from this issue.

Bug 200001909

Change-Id: Ieaf8352eb48aedbb984e05caec241aca3e593810
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/407592
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
drivers/video/tegra/host/nvhost_sync.c

index 4bb4bd58be669188cb51e4ff305c4bbf9d9bdf5e..66688defc8fdb7406e26c6d637c10417715f3f98 100644 (file)
@@ -220,7 +220,13 @@ static void nvhost_sync_pt_value_str(struct sync_pt *sync_pt, char *str,
                int size)
 {
        struct nvhost_sync_pt *pt = to_nvhost_sync_pt(sync_pt);
-       struct nvhost_sync_timeline *obj = pt->obj;
+       struct nvhost_sync_timeline *obj;
+
+       /* shared data may not be available yet */
+       if (!pt)
+               return;
+
+       obj = pt->obj;
 
        if (obj->id != NVSYNCPT_INVALID)
                snprintf(str, size, "%d", pt->thresh);