public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Christophe RICARD <christophe.ricard@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] NFC: st21nfcb: double free on allocation error
Date: Sat, 09 Aug 2014 21:49:03 +0000	[thread overview]
Message-ID: <20140809234903.030b479f@toffy-MacBookPro> (raw)

Hi Dan,

A patch fixing this issue got already sent to the linux-nfc mailing
list.
Here is a pointer to the patch:
https://lists.01.org/pipermail/linux-nfc/2014-July/002647.html

You are welcome to comment if anything is wrong.

Best Regards
Christophe
On Thu, 31 Jul 2014 12:41:23 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> "info" is allocated with devm_kzalloc() so calling kfree() here will
> lead to a double free.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/nfc/st21nfcb/st21nfcb.c
> b/drivers/nfc/st21nfcb/st21nfcb.c index 4d95863..6944f9e 100644
> --- a/drivers/nfc/st21nfcb/st21nfcb.c
> +++ b/drivers/nfc/st21nfcb/st21nfcb.c
> @@ -94,8 +94,7 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int
> phy_headroom, phy_headroom, phy_tailroom);
>  	if (!ndlc->ndev) {
>  		pr_err("Cannot allocate nfc ndev\n");
> -		r = -ENOMEM;
> -		goto err_alloc_ndev;
> +		return -ENOMEM;
>  	}
>  	info->ndlc = ndlc;
>  
> @@ -109,8 +108,6 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int
> phy_headroom, err_regdev:
>  	nci_free_device(ndlc->ndev);
>  
> -err_alloc_ndev:
> -	kfree(info);
>  	return r;
>  }
>  EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);


             reply	other threads:[~2014-08-09 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 21:49 Christophe RICARD [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-07-31  9:41 [patch] NFC: st21nfcb: double free on allocation error Dan Carpenter

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=20140809234903.030b479f@toffy-MacBookPro \
    --to=christophe.ricard@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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