1. 03 Mar, 2016 3 commits
    • Benjamin Poirier's avatar
      mld, igmp: Fix reserved tailroom calculation · 1837b2e2
      Benjamin Poirier authored
      The current reserved_tailroom calculation fails to take hlen and tlen into
      account.
      
      skb:
      [__hlen__|__data____________|__tlen___|__extra__]
      ^                                               ^
      head                                            skb_end_offset
      
      In this representation, hlen + data + tlen is the size passed to alloc_skb.
      "extra" is the extra space made available in __alloc_skb because of
      rounding up by kmalloc. We can reorder the representation like so:
      
      [__hlen__|__data____________|__extra__|__tlen___]
      ^                                               ^
      head                                            skb_end_offset
      
      The maximum space available for ip headers and payload without
      fragmentation is min(mtu, data + extra). Therefore,
      reserved_tailroom
      = data + extra + tlen - min(mtu, data + extra)
      = skb_end_offset - hlen - min(mtu, skb_end_offset - hlen - tlen)
      = skb_tailroom - min(mtu, skb_tailroom - tlen) ; after skb_reserve(hlen)
      
      Compare the second line to the current expression:
      reserved_tailroom = skb_end_offset - min(mtu, skb_end_offset)
      and we can see that hlen and tlen are not taken into account.
      
      The min() in the third line can be expanded into:
      if mtu < skb_tailroom - tlen:
      	reserved_tailroom = skb_tailroom - mtu
      else:
      	reserved_tailroom = tlen
      
      Depending on hlen, tlen, mtu and the number of multicast address records,
      the current code may output skbs that have less tailroom than
      dev->needed_tailroom or it may output more skbs than needed because not all
      space available is used.
      
      Fixes: 4c672e4b ("ipv6: mld: fix add_grhead skb_over_panic for devs with large MTUs")
      Signed-off-by: default avatarBenjamin Poirier <bpoirier@suse.com>
      Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1837b2e2
    • Igal Liberman's avatar
      fsl/fman: Initialize fman->dev earlier · 878e3c1b
      Igal Liberman authored
      Currently, in a case of error, dev_err is using fman->dev
      before its initialization and "(NULL device *)" is printed.
      This patch fixes this issue.
      Signed-off-by: default avatarIgal Liberman <igal.liberman@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      878e3c1b
    • Gabriel Fernandez's avatar
      stmmac: Fix 'eth0: No PHY found' regression · 88f8b1bb
      Gabriel Fernandez authored
      This patch manages the case when you have an Ethernet MAC with
      a "fixed link", and not connected to a normal MDIO-managed PHY device.
      
      The test of phy_bus_name was not helpful because it was never affected
      and replaced by the mdio test node.
      Signed-off-by: default avatarGabriel Fernandez <gabriel.fernandez@linaro.org>
      Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88f8b1bb
  2. 02 Mar, 2016 29 commits
  3. 01 Mar, 2016 8 commits
    • Sergei Shtylyov's avatar
      of_mdio: fix kernel-doc for of_phy_connect() · 735c1e25
      Sergei Shtylyov authored
      The 'flags' parameter of the of_phy_connect() function wasn't described
      in  the kernel-doc comment...
      Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      735c1e25
    • Xin Long's avatar
      sctp: sctp_remaddr_seq_show use the wrong variable to dump transport info · 3d73e8fa
      Xin Long authored
      Now in sctp_remaddr_seq_show(), we use variable *tsp to get the param *v.
      but *tsp is also used to traversal transport_addr_list, which will cover
      the previous value, and make sctp_transport_put work on the wrong transport.
      
      So fix it by adding a new variable to get the param *v.
      
      Fixes: fba4c330 ("sctp: hold transport before we access t->asoc in sctp proc")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d73e8fa
    • Xin Long's avatar
      sctp: lack the check for ports in sctp_v6_cmp_addr · 40b4f0fd
      Xin Long authored
      As the member .cmp_addr of sctp_af_inet6, sctp_v6_cmp_addr should also check
      the port of addresses, just like sctp_v4_cmp_addr, cause it's invoked by
      sctp_cmp_addr_exact().
      
      Now sctp_v6_cmp_addr just check the port when two addresses have different
      family, and lack the port check for two ipv6 addresses. that will make
      sctp_hash_cmp() cannot work well.
      
      so fix it by adding ports comparison in sctp_v6_cmp_addr().
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40b4f0fd
    • David S. Miller's avatar
      Merge branch 'phy-micrel-fixes' · f0da74bc
      David S. Miller authored
      Alexandre Belloni says:
      
      ====================
      phy: micrel: fix issues with interrupt on atmel boards
      
      Since the phy is not polled anymore, there were issues getting a link on the
      sama5d* xplained boards.
      
      I'm not too sure about were those fixes should go and I'm wondering whether the
      first one shoud be made generic.
      
      For the second one, I found the PHY_HAS_MAGICANEG flag that is not used and I
      wondering whether this is related to that kind of issue. I had a quick look at
      the history and could'nt find its use.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0da74bc
    • Alexandre Belloni's avatar
      phy: micrel: Disable auto negotiation on startup · 99f81afc
      Alexandre Belloni authored
      Disable auto negotiation on init to properly detect an already plugged
      cable at boot.
      
      At boot, when the phy is started, it is in the PHY_UP state.
      However, if a cable is plugged at boot, because auto negociation is already
      enabled at the time we get the first interrupt, the phy is already running.
      But the state machine then switches from PHY_UP to PHY_AN and calls
      phy_start_aneg(). phy_start_aneg() will not do anything because aneg is
      already enabled on the phy. It will then wait for a interrupt before going
      further. This interrupt will never happen unless the cable is unplugged and
      then replugged.
      
      It was working properly before 321beec5 (net: phy: Use interrupts when
      available in NOLINK state) because switching to NOLINK meant starting
      polling the phy, even if IRQ were enabled.
      
      Fixes: 321beec5 (net: phy: Use interrupts when available in NOLINK state)
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      99f81afc
    • Alexandre Belloni's avatar
      phy: micrel: Ensure interrupts are reenabled on resume · f5aba91d
      Alexandre Belloni authored
      At least on ksz8081, when getting back from power down, interrupts are
      disabled. ensure they are reenabled if they were previously enabled.
      
      This fixes resuming which is failing on the xplained boards from atmel
      since 321beec5 (net: phy: Use interrupts when available in NOLINK
      state)
      
      Fixes: 321beec5 (net: phy: Use interrupts when available in NOLINK state)
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5aba91d
    • Guillaume Nault's avatar
      ppp: lock ppp->flags in ppp_read() and ppp_poll() · edffc217
      Guillaume Nault authored
      ppp_read() and ppp_poll() can be called concurrently with ppp_ioctl().
      In this case, ppp_ioctl() might call ppp_ccp_closed(), which may update
      ppp->flags while ppp_read() or ppp_poll() is reading it.
      The update done by ppp_ccp_closed() isn't atomic due to the bit mask
      operation ('ppp->flags &= ~(SC_CCP_OPEN | SC_CCP_UP)'), so concurrent
      readers might get transient values.
      Reading incorrect ppp->flags may disturb the 'ppp->flags & SC_LOOP_TRAFFIC'
      test in ppp_read() and ppp_poll(), which in turn can lead to improper
      decision on whether the PPP unit file is ready for reading or not.
      
      Since ppp_ccp_closed() is protected by the Rx and Tx locks (with
      ppp_lock()), taking the Rx lock is enough for ppp_read() and ppp_poll()
      to guarantee that ppp_ccp_closed() won't update ppp->flags
      concurrently.
      
      The same reasoning applies to ppp->n_channels. The 'n_channels' field
      can also be written to concurrently by ppp_ioctl() (through
      ppp_connect_channel() or ppp_disconnect_channel()). These writes aren't
      atomic (simple increment/decrement), but are protected by both the Rx
      and Tx locks (like in the ppp->flags case). So holding the Rx lock
      before reading ppp->n_channels also prevents concurrent writes.
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      edffc217
    • Ivan Vecera's avatar
      bna: fix list corruption · a7f4b988
      Ivan Vecera authored
      Use list_move_tail() to move MAC address entry from list of pending
      to list of active entries. Simple list_add_tail() leaves the entry
      also in the first list, this leads to list corruption.
      
      Cc: Rasesh Mody <rasesh.mody@qlogic.com>
      Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
      Acked-by: default avatarRasesh Mody <rasesh.mody@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7f4b988