All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] net/core/dev: Warn on an impossibly short offload frame
@ 2016-01-03  0:25 Aaron Conole
  2016-01-03  1:06 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Conole @ 2016-01-03  0:25 UTC (permalink / raw)
  To: netdev; +Cc: Eric Dumazet, Aaron Conole

When signaling that a GRO frame is ready to be processed, the network stack
correctly checks length and aborts processing when a frame is less than 14
bytes. However, such a condition is really indicative of a broken driver,
and should be loudly signaled, rather than silently dropped as the case is
today.

Convert the condition to use WARN_ON() to ensure that the stack loudly
complains about such broken drivers.

Signed-off-by: Aaron Conole <aconole@bytheb.org>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 914b4a2..8af4e29 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4579,7 +4579,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
 	eth = skb_gro_header_fast(skb, 0);
 	if (unlikely(skb_gro_header_hard(skb, hlen))) {
 		eth = skb_gro_header_slow(skb, hlen, 0);
-		if (unlikely(!eth)) {
+		if (WARN_ON(!eth)) {
 			napi_reuse_skb(napi, skb);
 			return NULL;
 		}
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH next] net/core/dev: Warn on an impossibly short offload frame
  2016-01-03  0:25 [PATCH next] net/core/dev: Warn on an impossibly short offload frame Aaron Conole
@ 2016-01-03  1:06 ` Joe Perches
  2016-01-05 18:36   ` Aaron Conole
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2016-01-03  1:06 UTC (permalink / raw)
  To: Aaron Conole, netdev; +Cc: Eric Dumazet

On Sat, 2016-01-02 at 19:25 -0500, Aaron Conole wrote:
> When signaling that a GRO frame is ready to be processed, the network stack
> correctly checks length and aborts processing when a frame is less than 14
> bytes. However, such a condition is really indicative of a broken driver,
> and should be loudly signaled, rather than silently dropped as the case is
> today.
> 
> Convert the condition to use WARN_ON() to ensure that the stack loudly
> complains about such broken drivers.
[]
> diff --git a/net/core/dev.c b/net/core/dev.c
[]
> @@ -4579,7 +4579,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
>  	eth = skb_gro_header_fast(skb, 0);
>  	if (unlikely(skb_gro_header_hard(skb, hlen))) {
>  		eth = skb_gro_header_slow(skb, hlen, 0);
> -		if (unlikely(!eth)) {
> +		if (WARN_ON(!eth)) {
>  			napi_reuse_skb(napi, skb);
>  			return NULL;
>  		}

It's generally a good idea to use
WARN_ON_RATELIMIT or WARN_ON_ONCE.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] net/core/dev: Warn on an impossibly short offload frame
  2016-01-03  1:06 ` Joe Perches
@ 2016-01-05 18:36   ` Aaron Conole
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Conole @ 2016-01-05 18:36 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, Eric Dumazet

Joe Perches <joe@perches.com> writes:
> On Sat, 2016-01-02 at 19:25 -0500, Aaron Conole wrote:
>> When signaling that a GRO frame is ready to be processed, the network stack
>> correctly checks length and aborts processing when a frame is less than 14
>> bytes. However, such a condition is really indicative of a broken driver,
>> and should be loudly signaled, rather than silently dropped as the case is
>> today.
>> 
>> Convert the condition to use WARN_ON() to ensure that the stack loudly
>> complains about such broken drivers.
> []
>> diff --git a/net/core/dev.c b/net/core/dev.c
> []
>> @@ -4579,7 +4579,7 @@ static struct sk_buff *napi_frags_skb(struct
>> napi_struct *napi)
>>  	eth = skb_gro_header_fast(skb, 0);
>>  	if (unlikely(skb_gro_header_hard(skb, hlen))) {
>>  		eth = skb_gro_header_slow(skb, hlen, 0);
>> -		if (unlikely(!eth)) {
>> +		if (WARN_ON(!eth)) {
>>  			napi_reuse_skb(napi, skb);
>>  			return NULL;
>>  		}
>
> It's generally a good idea to use
> WARN_ON_RATELIMIT or WARN_ON_ONCE.

Okay, I'll respin switching to WARN_ON_RATELIMIT, if that's a better
approach.

Thanks for the review, Joe!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-05 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-03  0:25 [PATCH next] net/core/dev: Warn on an impossibly short offload frame Aaron Conole
2016-01-03  1:06 ` Joe Perches
2016-01-05 18:36   ` Aaron Conole

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.