diff mbox

[net] net: fix harmonize_features() vs NETIF_F_HIGHDMA

Message ID 1484770337.13165.120.camel@edumazet-glaptop3.roam.corp.google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Jan. 18, 2017, 8:12 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

Ashizuka reported a highmem oddity and sent a patch for freescale
fec driver.

But the problem root cause is that core networking stack
must ensure no skb with highmem fragment is ever sent through
a device that does not assert NETIF_F_HIGHDMA in its features.

We need to call illegal_highdma() from harmonize_features()
regardless of CSUM checks.

Fixes: ec5f06156423 ("net: Kill link between CSUM and SG features.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Pravin Shelar <pshelar@ovn.org>
Reported-by: "Ashizuka, Yuusuke" <ashiduka@jp.fujitsu.com>
---
 net/core/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Miller Jan. 18, 2017, 8:25 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Jan 2017 12:12:17 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Ashizuka reported a highmem oddity and sent a patch for freescale
> fec driver.
> 
> But the problem root cause is that core networking stack
> must ensure no skb with highmem fragment is ever sent through
> a device that does not assert NETIF_F_HIGHDMA in its features.
> 
> We need to call illegal_highdma() from harmonize_features()
> regardless of CSUM checks.
> 
> Fixes: ec5f06156423 ("net: Kill link between CSUM and SG features.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Pravin Shelar <pshelar@ovn.org>
> Reported-by: "Ashizuka, Yuusuke" <ashiduka@jp.fujitsu.com>

Applied, thanks Eric.

I guess few devices support SG and lack highmem support.
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 07b307b0b414730688b64fdb2295b0fa1b721e51..7f218e095361520d11c243d650e053321ea7274f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2795,9 +2795,9 @@  static netdev_features_t harmonize_features(struct sk_buff *skb,
 	if (skb->ip_summed != CHECKSUM_NONE &&
 	    !can_checksum_protocol(features, type)) {
 		features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
-	} else if (illegal_highdma(skb->dev, skb)) {
-		features &= ~NETIF_F_SG;
 	}
+	if (illegal_highdma(skb->dev, skb))
+		features &= ~NETIF_F_SG;
 
 	return features;
 }