From: Daniel Borkmann <daniel@iogearbox.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, sowmini.varadhan@oracle.com,
willemb@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] packet: fix panic in __packet_set_timestamp on tpacket_v3 in tx mode
Date: Thu, 05 Jan 2017 20:10:07 +0100 [thread overview]
Message-ID: <586E9A0F.1020002@iogearbox.net> (raw)
In-Reply-To: <1483640872.9712.1.camel@edumazet-glaptop3.roam.corp.google.com>
On 01/05/2017 07:27 PM, Eric Dumazet wrote:
> On Thu, 2017-01-05 at 02:34 +0100, Daniel Borkmann wrote:
[...]
>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index 7e39087..ddbda25 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -481,6 +481,9 @@ static __u32 __packet_set_timestamp(struct packet_sock *po, void *frame,
>> h.h2->tp_nsec = ts.tv_nsec;
>> break;
>> case TPACKET_V3:
>> + h.h3->tp_sec = ts.tv_sec;
>> + h.h3->tp_nsec = ts.tv_nsec;
>> + break;
>> default:
>> WARN(1, "TPACKET version not supported.\n");
>> BUG();
>
> Gosh. Can we also replace this BUG() into something less aggressive ?
There are currently 5 of these WARN() + BUG() constructs and 1 BUG()-only
for the 'default' TPACKET version spread all over af_packet, so probably
makes sense to rather make all of them less aggressive.
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index b9e1a13b4ba36a0bc7edf6a8c2c116c7d48c970c..0c0d268544787dcbef6601c5014e7d3836d16f96 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -476,9 +476,11 @@ static __u32 __packet_set_timestamp(struct packet_sock *po, void *frame,
> h.h2->tp_nsec = ts.tv_nsec;
> break;
> case TPACKET_V3:
> + h.h3->tp_sec = ts.tv_sec;
> + h.h3->tp_nsec = ts.tv_nsec;
> + break;
> default:
> - WARN(1, "TPACKET version not supported.\n");
> - BUG();
> + pr_err_once("TPACKET version %u not supported.\n", po->tp_version);
> }
>
> /* one flush is safe, as both fields always lie on the same cacheline */
>
>
next prev parent reply other threads:[~2017-01-05 19:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 1:34 [PATCH net-next] packet: fix panic in __packet_set_timestamp on tpacket_v3 in tx mode Daniel Borkmann
2017-01-05 2:10 ` Sowmini Varadhan
2017-01-05 4:51 ` David Miller
2017-01-05 18:27 ` Eric Dumazet
2017-01-05 19:10 ` Daniel Borkmann [this message]
2017-03-06 17:13 ` chetan loke
2017-03-06 17:45 ` Willem de Bruijn
2017-03-06 21:36 ` chetan loke
2017-03-06 22:13 ` Willem de Bruijn
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=586E9A0F.1020002@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sowmini.varadhan@oracle.com \
--cc=willemb@google.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).