From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org, Alexey.Brodkin@synopsys.com,
richardcochran@gmail.com
Subject: Re: [PATCH v2] arc_emac: fix potential use after free
Date: Fri, 27 Dec 2013 13:05:06 -0500 (EST) [thread overview]
Message-ID: <20131227.130506.1806271226641881502.davem@davemloft.net> (raw)
In-Reply-To: <1387505440.19078.419.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 19 Dec 2013 18:10:40 -0800
> Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> skb_tx_timestamp(skb) should be called _before_ TX completion
> has a chance to trigger, otherwise it is too late and we access
> freed memory.
>
> Fixes: e4f2379db6c6 ("ethernet/arc/arc_emac - Add new driver")
> From: Eric Dumazet <edumazet@google.com>
> Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
Applied, thanks.
I've seen this bug enough times that I've expanded the comment
a bit more.
====================
[PATCH] net: Add some clarification to skb_tx_timestamp() comment.
We've seen so many instances of people invoking skb_tx_timestamp()
after the device already has been given the packet, that it's worth
being a little bit more verbose and explicit in this comment.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/linux/skbuff.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6aae838..6f69b3f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2531,6 +2531,10 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
* Ethernet MAC Drivers should call this function in their hard_xmit()
* function immediately before giving the sk_buff to the MAC hardware.
*
+ * Specifically, one should make absolutely sure that this function is
+ * called before TX completion of this packet can trigger. Otherwise
+ * the packet could potentially already be freed.
+ *
* @skb: A socket buffer.
*/
static inline void skb_tx_timestamp(struct sk_buff *skb)
--
1.7.11.7
prev parent reply other threads:[~2013-12-27 18:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 1:58 [PATCH] arc_emac: fix Eric Dumazet
2013-12-20 2:05 ` Eric Dumazet
2013-12-20 2:10 ` [PATCH v2] arc_emac: fix potential use after free Eric Dumazet
2013-12-20 14:06 ` Alexey Brodkin
2013-12-27 18:05 ` David Miller [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=20131227.130506.1806271226641881502.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Alexey.Brodkin@synopsys.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.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;
as well as URLs for NNTP newsgroup(s).