public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] NFC: nci: fix memory leak
Date: Wed, 9 Dec 2015 17:29:24 +0530	[thread overview]
Message-ID: <20151209115924.GD24852@sudip-pc> (raw)
In-Reply-To: <1447678635-11146-1-git-send-email-sudipm.mukherjee@gmail.com>

On Mon, Nov 16, 2015 at 06:27:15PM +0530, Sudip Mukherjee wrote:
> In case of invalid number_destination_params we were returning error but
> we missed releasing cmd. Lets check for the number of parameter before
> allocating memory so that we don't have a memory leak.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---

A gentle ping.

regards
sudip


>  net/nfc/nci/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
> index 10c99a5..fbb7a2b 100644
> --- a/net/nfc/nci/core.c
> +++ b/net/nfc/nci/core.c
> @@ -610,14 +610,14 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type,
>  	struct nci_core_conn_create_cmd *cmd;
>  	struct core_conn_create_data data;
>  
> +	if (!number_destination_params)
> +		return -EINVAL;
> +
>  	data.length = params_len + sizeof(struct nci_core_conn_create_cmd);
>  	cmd = kzalloc(data.length, GFP_KERNEL);
>  	if (!cmd)
>  		return -ENOMEM;
>  
> -	if (!number_destination_params)
> -		return -EINVAL;
> -
>  	cmd->destination_type = destination_type;
>  	cmd->number_destination_params = number_destination_params;
>  	memcpy(cmd->params, params, params_len);
> -- 
> 1.9.1
> 

      reply	other threads:[~2015-12-09 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 12:57 [PATCH] NFC: nci: fix memory leak Sudip Mukherjee
2015-12-09 11:59 ` Sudip Mukherjee [this message]

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=20151209115924.GD24852@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=aloisio.almeida@openbossa.org \
    --cc=davem@davemloft.net \
    --cc=lauro.venancio@openbossa.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sameo@linux.intel.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