public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Vitaly Kuznetsov <vkuznets@redhat.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:54:07 +0300	[thread overview]
Message-ID: <20151116155407.GK18797@mwanda> (raw)
In-Reply-To: <1447327936-26035-2-git-send-email-vkuznets@redhat.com>

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.
Also it might be nice to preserve the error code.

	ret = hvt->on_msg(inmsg, count);

	kfree(inmsg);

	return ret ? ret : count;

regards,
dan carpenter

  reply	other threads:[~2015-11-16 15:54 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 [this message]
2015-11-16 17:40     ` Vitaly Kuznetsov
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=20151116155407.GK18797@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    --cc=vkuznets@redhat.com \
    /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