From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: devel@linuxdriverproject.org,
Haiyang Zhang <haiyangz@microsoft.com>,
Olaf Hering <olaf@aepfle.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] Drivers: hv: utils: fix memory leak on on_msg() failure
Date: Mon, 16 Nov 2015 18:40:36 +0100 [thread overview]
Message-ID: <874mglx2p7.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20151116155407.GK18797@mwanda> (Dan Carpenter's message of "Mon, 16 Nov 2015 18:54:07 +0300")
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
next prev parent reply other threads:[~2015-11-16 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 11:32 [PATCH 0/4] Drivers: hv: utils: prevent crash when a utility driver is disabled host side Vitaly Kuznetsov
2015-11-12 11:32 ` [PATCH 1/4] Drivers: hv: utils: fix memory leak on on_msg() failure Vitaly Kuznetsov
2015-11-16 15:54 ` Dan Carpenter
2015-11-16 17:40 ` Vitaly Kuznetsov [this message]
2015-11-12 11:32 ` [PATCH 2/4] Drivers: hv: utils: rename outmsg_lock Vitaly Kuznetsov
2015-11-12 11:32 ` [PATCH 3/4] Drivers: hv: utils: introduce HVUTIL_TRANSPORT_DESTROY mode Vitaly Kuznetsov
2015-11-12 11:32 ` [PATCH 4/4] Drivers: hv: utils: fix crash when device is removed from host side Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874mglx2p7.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox