7205-fsl-dpaa2-eth-sanitize-supported-private-flags.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From 51106cb1fd14dfbf62c2760921463376f56ac732 Mon Sep 17 00:00:00 2001
  2. From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
  3. Date: Tue, 21 Jun 2016 18:40:47 +0000
  4. Subject: [PATCH 205/226] fsl-dpaa2: eth: sanitize supported private flags
  5. On linux-v4.6 with CONFIG_MACVLAN=y, when bringing up a ni interface, the
  6. network stack crashes due to a segfault. This is related to the
  7. macvlan_device_event notifier, which registers itself to all the network
  8. interface in the system.
  9. The notifier reads the netdev private flags and incorrectly qualifies
  10. the interface as a macvlan port, since both the IFF_MACVLAN_PORT and
  11. IFF_PROMISC flags have the same offset. Code spelunking reveals that
  12. IFF_PROMISC is only used as an interface flag, not a private interface
  13. flag.
  14. A similar situation happens with IFF_ALLMULTI, which overlaps with
  15. IFF_BRIDGE_PORT. No info on the consequences of this, since I haven't
  16. tested bridge scenarios. The interface can still be set in allmulti
  17. mode using userspace tools (e.g. ifconfig).
  18. IFF_MULTICAST overlaps with IFF_UNICAST_FLT, therefore the current code
  19. has no effect as it is. The closest multicast activation based on device
  20. capabilities has been seen in the case of the Aeroflex Gaisler Ethernet
  21. MAC (aeroflex/greth.c) - here, the runtime (not private) flag is set on
  22. device probe. On a side node, ether_setup enables IFF_MULTICAST by default.
  23. Remove IFF_PROMISC, IFF_ALLMULTI and IFF_MULTICAST from device capabilities
  24. init.
  25. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
  26. ---
  27. drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 7 +------
  28. 1 file changed, 1 insertion(+), 6 deletions(-)
  29. --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
  30. +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
  31. @@ -1176,18 +1176,13 @@ static int dpaa2_eth_init(struct net_dev
  32. u32 options = priv->dpni_attrs.options;
  33. /* Capabilities listing */
  34. - supported |= IFF_LIVE_ADDR_CHANGE | IFF_PROMISC | IFF_ALLMULTI;
  35. + supported |= IFF_LIVE_ADDR_CHANGE;
  36. if (options & DPNI_OPT_UNICAST_FILTER)
  37. supported |= IFF_UNICAST_FLT;
  38. else
  39. not_supported |= IFF_UNICAST_FLT;
  40. - if (options & DPNI_OPT_MULTICAST_FILTER)
  41. - supported |= IFF_MULTICAST;
  42. - else
  43. - not_supported |= IFF_MULTICAST;
  44. -
  45. net_dev->priv_flags |= supported;
  46. net_dev->priv_flags &= ~not_supported;