lkml.org 
[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/4] Drivers: hv: utils: fix memory leak on on_msg() failure
Date
Dan Carpenter <dan.carpenter@oracle.com> writes:

> On Thu, Nov 12, 2015 at 12:32:13PM +0100, Vitaly Kuznetsov wrote:
>> @@ -85,10 +86,10 @@ static ssize_t hvt_op_write(struct file *file, const char __user *buf,
>> return PTR_ERR(inmsg);
>>
>> if (hvt->on_msg(inmsg, count))
>> - return -EFAULT;
>> + ret = -EFAULT;
>
> You fix this leak and then re-introduce it again directly in patch
> 3/4.

Such a shame ... Thanks for noticing!

> Also it might be nice to preserve the error code.
>
> ret = hvt->on_msg(inmsg, count);
>
> kfree(inmsg);
>
> return ret ? ret : count;

It seems on_msg() hooks can only return -EINVAL now but why not
... let's do it in v2.

--
Vitaly


\
 
 \ /
  Last update: 2015-11-16 19:01    [W:0.040 / U:10.988 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site