From: Dan Carpenter <error27@gmail.com>
To: miquel.raynal@bootlin.com
Cc: linux-wpan@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: [bug report] mac802154: Move an skb free within the rx path
Date: Thu, 15 Dec 2022 11:05:47 +0300 [thread overview]
Message-ID: <Y5rVW/Mb8nw0MCF3@kili> (raw)
Hello Miquel Raynal,
The patch 4d1c7d87030b: "mac802154: Move an skb free within the rx
path" from Oct 26, 2022, leads to the following Smatch static checker
warning:
net/mac802154/rx.c:307 ieee802154_rx()
warn: 'skb' was already freed.
net/mac802154/rx.c
271 void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb)
272 {
273 u16 crc;
274
275 WARN_ON_ONCE(softirq_count() == 0);
276
277 if (local->suspended)
278 goto free_skb;
279
280 /* TODO: When a transceiver omits the checksum here, we
281 * add an own calculated one. This is currently an ugly
282 * solution because the monitor needs a crc here.
283 */
284 if (local->hw.flags & IEEE802154_HW_RX_OMIT_CKSUM) {
285 crc = crc_ccitt(0, skb->data, skb->len);
286 put_unaligned_le16(crc, skb_put(skb, 2));
287 }
288
289 rcu_read_lock();
290
291 ieee802154_monitors_rx(local, skb);
292
293 /* Level 1 filtering: Check the FCS by software when relevant */
294 if (local->hw.phy->filtering == IEEE802154_FILTERING_NONE) {
295 crc = crc_ccitt(0, skb->data, skb->len);
296 if (crc)
297 goto drop;
298 }
299 /* remove crc */
300 skb_trim(skb, skb->len - 2);
301
302 __ieee802154_rx_handle_packet(local, skb);
This frees skb.
303
304 drop:
305 rcu_read_unlock();
306 free_skb:
--> 307 kfree_skb(skb);
Double free.
308 }
regards,
dan carpenter
next reply other threads:[~2022-12-15 8:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 8:05 Dan Carpenter [this message]
2022-12-16 13:59 ` [bug report] mac802154: Move an skb free within the rx path Miquel Raynal
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=Y5rVW/Mb8nw0MCF3@kili \
--to=error27@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=miquel.raynal@bootlin.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