summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/intel_th
diff options
context:
space:
mode:
authorLaurent FERT <laurent.fert@intel.com>2016-02-15 17:11:57 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 22:09:14 (GMT)
commit2bed074aade2caa9c350121837c55189a8fd197e (patch)
tree58fc1c1a2d93f03461fd702c8ae6c1a0a70e611a /drivers/hwtracing/intel_th
parente4eca2a1c71fda33cd8b5aacc7744176e440f80d (diff)
downloadlinux-2bed074aade2caa9c350121837c55189a8fd197e.tar.xz
intel_th: msu: Release resources on read error
Right now, reading from msc character device will leak its's user count on read error. This patch makes sure resources are released when there is no data left to read from the buffer. Signed-off-by: Laurent FERT <laurent.fert@intel.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r--drivers/hwtracing/intel_th/msu.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 3c793bb..d9d6022 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1112,12 +1112,11 @@ static ssize_t intel_th_msc_read(struct file *file, char __user *buf,
size = msc->nr_pages << PAGE_SHIFT;
if (!size)
- return 0;
+ goto put_count;
- if (off >= size) {
- len = 0;
+ if (off >= size)
goto put_count;
- }
+
if (off + len >= size)
len = size - off;