misc: tegra-profiler: fix backtracing
Igor Nabirushkin [Mon, 5 Aug 2013 16:34:13 +0000 (20:34 +0400)]
check_vma_address function:
sometimes (rarely): address value may be overflowed.

Bug 1312406

Change-Id: Ibf268000dfcba4046c499f734c368a0854d0f942
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/258236
(cherry picked from commit 6d41daab2b4d6ede2e16a0b0354631e8a6648d8b)
Reviewed-on: http://git-master/r/264760
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Daniel Horowitz <dhorowitz@nvidia.com>
Reviewed-by: Bo Yan <byan@nvidia.com>

drivers/misc/tegra-profiler/backtrace.c
drivers/misc/tegra-profiler/version.h

index dd7c67c..ea68e98 100644 (file)
@@ -38,12 +38,14 @@ quadd_callchain_store(struct quadd_callchain *callchain_data, u32 ip)
 static int
 check_vma_address(unsigned long addr, struct vm_area_struct *vma)
 {
-       unsigned long start, end;
+       unsigned long start, end, length;
 
        if (vma) {
                start = vma->vm_start;
                end = vma->vm_end;
-               if (addr >= start && addr + sizeof(unsigned long) <= end)
+               length = end - start;
+               if (length > sizeof(unsigned long) &&
+                   addr >= start && addr <= end - sizeof(unsigned long))
                        return 0;
        }
        return -EINVAL;
index 6bfd1a3..acc278b 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.25"
+#define QUADD_MODULE_VERSION           "1.26"
 #define QUADD_MODULE_BRANCH            "Blackrock2"
 
 #endif /* __QUADD_VERSION_H */