提交 2bed074a 编写于 作者: L Laurent FERT 提交者: Greg Kroah-Hartman

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: NLaurent FERT <laurent.fert@intel.com>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e4eca2a1
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册