[PATCH 3.16 239/370] net: fix harmonize_features() vs NETIF_F_HIGHDMA

From: Ben Hutchings
Date: Fri Mar 10 2017 - 07:19:39 EST

3.16.42-rc1 review patch. If anyone has any objections, please let me know.


From: Eric Dumazet <edumazet@xxxxxxxxxx>

commit 7be2c82cfd5d28d7adb66821a992604eb6dd112e upstream.

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@xxxxxxxxxx>
Cc: Pravin Shelar <pshelar@xxxxxxx>
Reported-by: "Ashizuka, Yuusuke" <ashiduka@xxxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
net/core/dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2555,9 +2555,9 @@ static netdev_features_t harmonize_featu
if (skb->ip_summed != CHECKSUM_NONE &&
!can_checksum_protocol(features, type)) {
features &= ~NETIF_F_ALL_CSUM;
- } else if (illegal_highdma(skb->dev, skb)) {
- features &= ~NETIF_F_SG;
+ if (illegal_highdma(skb->dev, skb))
+ features &= ~NETIF_F_SG;

return features;