Linux wireless drivers development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: thierry.escande@linux.intel.com
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] NFC Digital: Add target NFC-DEP support
Date: Thu, 23 Feb 2017 13:45:09 +0300	[thread overview]
Message-ID: <20170223104509.GB27526@mwanda> (raw)

Hello Thierry Escande,

The patch 1c7a4c24fbfd: "NFC Digital: Add target NFC-DEP support"
from Sep 19, 2013, leads to the following static checker warning:

	net/nfc/digital_dep.c:1303 digital_tg_recv_dep_req()
	error: double free of 'resp'

net/nfc/digital_dep.c
  1287  
  1288                  goto free_resp;
  1289          }
  1290  
  1291          rc = nfc_tm_data_received(ddev->nfc_dev, resp);

This function does a kfree_skb() on the error path.  I don't know about
the success path.  Other code seems to assume it frees on success so
maybe?

  1292  
  1293  exit:
  1294          kfree_skb(ddev->chaining_skb);
  1295          ddev->chaining_skb = NULL;
  1296  
  1297          ddev->atn_count = 0;
  1298  
  1299          kfree_skb(ddev->saved_skb);
  1300          ddev->saved_skb = NULL;
  1301  
  1302          if (rc)
  1303                  kfree_skb(resp);

Of course kfree_skb() is refcounted but I think this has to be a bug.

  1304  
  1305          return;
  1306  
  1307  free_resp:
  1308          dev_kfree_skb(resp);

But then we do dev_kfree_skb() here.  It's not clear to me why sometimes
we use regular kfree_skb() but not here.

  1309  }

regards,
dan carpenter

             reply	other threads:[~2017-02-23 10:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 10:45 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-19 12:22 [bug report] NFC Digital: Add target NFC-DEP support 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=20170223104509.GB27526@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=thierry.escande@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