1. 23 Oct, 2018 10 commits
    • Shiju Jose's avatar
      net: hns3: Add PCIe AER callback error_detected · 5a9f0eac
      Shiju Jose authored
      Set of hw errors occurred in the HNS3 are reported to the
      hns3 driver through PCIe AER and RAS.The error info will be
      processed and appropriately recovered.
      This patch adds error_detected callback and error processing.
      Signed-off-by: default avatarShiju Jose <shiju.jose@huawei.com>
      Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a9f0eac
    • Nathan Chancellor's avatar
      mISDN: Fix type of switch control variable in ctrl_teimanager · aeb5e02a
      Nathan Chancellor authored
      Clang warns (trimmed for brevity):
      
      drivers/isdn/mISDN/tei.c:1193:7: warning: overflow converting case value
      to switch condition type (2147764552 to 18446744071562348872) [-Wswitch]
              case IMHOLD_L1:
                   ^
      drivers/isdn/mISDN/tei.c:1187:7: warning: overflow converting case value
      to switch condition type (2147764550 to 18446744071562348870) [-Wswitch]
              case IMCLEAR_L2:
                   ^
      2 warnings generated.
      
      The root cause is that the _IOC macro can generate really large numbers,
      which don't find into type int. My research into how GCC and Clang are
      handling this at a low level didn't prove fruitful and surveying the
      kernel tree shows that aside from here and a few places in the scsi
      subsystem, everything that uses _IOC is at least of type 'unsigned int'.
      Make that change here because as nothing in this function cares about
      the signedness of the variable and it removes ambiguity, which is never
      good when dealing with compilers.
      
      While we're here, remove the unnecessary local variable ret (just return
      -EINVAL and 0 directly).
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/67Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aeb5e02a
    • Jon Maloy's avatar
      tipc: eliminate message disordering during binding table update · 988f3f16
      Jon Maloy authored
      We have seen the following race scenario:
      1) named_distribute() builds a "bulk" message, containing a PUBLISH
         item for a certain publication. This is based on the contents of
         the binding tables's 'cluster_scope' list.
      2) tipc_named_withdraw() removes the same publication from the list,
         bulds a WITHDRAW message and distributes it to all cluster nodes.
      3) tipc_named_node_up(), which was calling named_distribute(), sends
         out the bulk message built under 1)
      4) The WITHDRAW message arrives at the just detected node, finds
         no corresponding publication, and is dropped.
      5) The PUBLISH item arrives at the same node, is added to its binding
         table, and remains there forever.
      
      This arrival disordering was earlier taken care of by the backlog queue,
      originally added for a different purpose, which was removed in the
      commit referred to below, but we now need a different solution.
      In this commit, we replace the rcu lock protecting the 'cluster_scope'
      list with a regular RW lock which comprises even the sending of the
      bulk message. This both guarantees both the list integrity and the
      message sending order. We will later add a commit which cleans up
      this code further.
      
      Note that this commit needs recently added commit d3092b2e ("tipc:
      fix unsafe rcu locking when accessing publication list") to apply
      cleanly.
      
      Fixes: 37922ea4 ("tipc: permit overlapping service ranges in name table")
      Reported-by: default avatarTuong Lien Tong <tuong.t.lien@dektech.com.au>
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      988f3f16
    • YueHaibing's avatar
      octeontx2-af: Remove set but not used variables 'devnum, is_pf' · eec6f752
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c: In function 'rvu_detach_rsrcs':
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c:855:6: warning:
       variable 'devnum' set but not used [-Wunused-but-set-variable]
      
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c:853:7: warning:
       variable 'is_pf' set but not used [-Wunused-but-set-variable]
      
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c: In function 'rvu_mbox_handler_ATTACH_RESOURCES':
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c:1054:7: warning:
       variable 'is_pf' set but not used [-Wunused-but-set-variable]
      
      drivers/net/ethernet/marvell/octeontx2/af/rvu.c:1053:6: warning:
       variable 'devnum' set but not used [-Wunused-but-set-variable]
      
      It never used since introduction in commit
      746ea742 ("octeontx2-af: Add RVU block LF provisioning support")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eec6f752
    • YueHaibing's avatar
      octeontx2-af: Remove set but not used variable 'block' · 665fc901
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c: In function 'rvu_npa_init':
      drivers/net/ethernet/marvell/octeontx2/af/rvu_npa.c:446:20: warning:
       variable 'block' set but not used [-Wunused-but-set-variable]
      
      It never used since introduction in
      commit 7a37245e ("octeontx2-af: NPA block admin queue init")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      665fc901
    • David S. Miller's avatar
      Merge branch 'phy-ocelot-serdes-fix-out-of-bounds-read' · 627d39c3
      David S. Miller authored
      Gustavo A. R. Silva says:
      
      ====================
      phy: ocelot-serdes: fix out-of-bounds read
      
      This patchset aims to fix an out-of-bounds bug in
      the phy-ocelot-serdes driver.
      
      Currently, there is an out-of-bounds read on array ctrl->phys,
      once variable i reaches the maximum array size of SERDES_MAX
      in the for loop.
      
      Quentin Schulz pointed out that SERDES_MAX is a valid value to
      index ctrl->phys. So, I updated SERDES_MAX to be SERDES6G_MAX + 1
      in include/dt-bindings/phy/phy-ocelot-serdes.h.
      
      Then I changed the condition in the for loop from
      i <= SERDES_MAX to i < SERDES_MAX in order to
      complete the fix.
      
      The reason I'm sending this fix as series is because
      checkpatch reported an error when I first tried to
      integrate the whole solution into a singe patch. So,
      changes to dt-bindings should be sent as a separate
      patch.
      
      Changes in v3:
       - Post the series to netdev, so Dave can take it.
      
      Changes in v2:
       - Send the whole series to Kishon Vijay Abraham I, so it
         can be taken into the PHY tree.
       - Add Quentin's Reviewed-by to commit log in both patches.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      627d39c3
    • Gustavo A. R. Silva's avatar
      phy: ocelot-serdes: fix out-of-bounds read · 6acb47d1
      Gustavo A. R. Silva authored
      Currently, there is an out-of-bounds read on array ctrl->phys,
      once variable i reaches the maximum array size of SERDES_MAX
      in the for loop.
      
      Fix this by changing the condition in the for loop from
      i <= SERDES_MAX to i < SERDES_MAX.
      
      Addresses-Coverity-ID: 1473966 ("Out-of-bounds read")
      Addresses-Coverity-ID: 1473959 ("Out-of-bounds read")
      Fixes: 51f6b410 ("phy: add driver for Microsemi Ocelot SerDes muxing")
      Reviewed-by: default avatarQuentin Schulz <quentin.schulz@bootlin.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6acb47d1
    • Gustavo A. R. Silva's avatar
      dt-bindings: phy: Update SERDES_MAX to be SERDES_MAX + 1 · 81fa7a69
      Gustavo A. R. Silva authored
      SERDES_MAX is a valid value to index ctrl->phys in
      drivers/phy/mscc/phy-ocelot-serdes.c. But, currently,
      there is an out-of-bounds bug in the mentioned driver
      when reading from ctrl->phys, because the size of
      array ctrl->phys is SERDES_MAX.
      
      Partially fix this by updating SERDES_MAX to be SERDES6G_MAX + 1.
      
      Notice that this is the first part of the solution to
      the out-of-bounds bug mentioned above. Although this
      change is not dependent on any other one.
      Suggested-by: default avatarQuentin Schulz <quentin.schulz@bootlin.com>
      Reviewed-by: default avatarQuentin Schulz <quentin.schulz@bootlin.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      81fa7a69
    • Guoqing Jiang's avatar
      tipc: use destination length for copy string · 29e270fc
      Guoqing Jiang authored
      Got below warning with gcc 8.2 compiler.
      
      net/tipc/topsrv.c: In function ‘tipc_topsrv_start’:
      net/tipc/topsrv.c:660:2: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
        strncpy(srv->name, name, strlen(name) + 1);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      net/tipc/topsrv.c:660:27: note: length computed here
        strncpy(srv->name, name, strlen(name) + 1);
                                 ^~~~~~~~~~~~
      So change it to correct length and use strscpy.
      Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29e270fc
    • Nathan Chancellor's avatar
      isdn: hfc_{pci,sx}: Avoid empty body if statements · a1930a98
      Nathan Chancellor authored
      Clang warns:
      
      drivers/isdn/hisax/hfc_pci.c:131:34: error: if statement has empty body
      [-Werror,-Wempty-body]
              if (Read_hfc(cs, HFCPCI_INT_S1));
                                              ^
      drivers/isdn/hisax/hfc_pci.c:131:34: note: put the semicolon on a
      separate line to silence this warning
      
      In my attempt to hide the warnings because I thought they didn't serve
      any purpose[1], Masahiro Yamada pointed out that {Read,Write}_hfc in
      hci_pci.c should be using a standard register access method; otherwise,
      the compiler will just remove the if statements.
      
      For hfc_pci, use the versions of {Read,Write}_hfc found in
      drivers/isdn/hardware/mISDN/hfc_pCI.h while converting pci_io to be
      'void __iomem *' (and clean up ioremap) then remove the empty if
      statements.
      
      For hfc_sx, {Read,Write}_hfc are already use a proper register accessor
      (inb, outb) so just remove the unnecessary if statements.
      
      [1]: https://lore.kernel.org/lkml/20181016021454.11953-1-natechancellor@gmail.com/
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/66Suggested-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1930a98
  2. 22 Oct, 2018 11 commits
  3. 21 Oct, 2018 14 commits
  4. 20 Oct, 2018 5 commits
    • David Ahern's avatar
      net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs · 4ba4c566
      David Ahern authored
      The loop wants to skip previously dumped addresses, so loops until
      current index >= saved index. If the message fills it wants to save
      the index for the next address to dump - ie., the one that did not
      fit in the current message.
      
      Currently, it is incrementing the index counter before comparing to the
      saved index, and then the saved index is off by 1 - it assumes the
      current address is going to fit in the message.
      
      Change the index handling to increment only after a succesful dump.
      
      Fixes: 502a2ffd ("ipv6: convert idev_list to list macros")
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ba4c566
    • Daniel Borkmann's avatar
      Merge branch 'bpf-msg-push-data' · 2576b967
      Daniel Borkmann authored
      John Fastabend says:
      
      ====================
      This series adds a new helper bpf_msg_push_data to be used by
      sk_msg programs. The helper can be used to insert extra bytes into
      the message that can then be used by the program as metadata tags
      among other things.
      
      The first patch adds the helper, second patch the libbpf support,
      and last patch updates test_sockmap to run msg_push_data tests.
      
      v2: rebase after queue map and in filter.c convert int -> u32
      ====================
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      2576b967
    • John Fastabend's avatar
      bpf: test_sockmap add options to use msg_push_data · 84fbfe02
      John Fastabend authored
      Add options to run msg_push_data, this patch creates two more flags
      in test_sockmap that can be used to specify the offset and length
      of bytes to be added. The new options are --txmsg_start_push to
      specify where bytes should be inserted and --txmsg_end_push to
      specify how many bytes. This is analagous to the options that are
      used to pull data, --txmsg_start and --txmsg_end.
      
      In addition to adding the options tests are added to the test
      suit to run the tests similar to what was done for msg_pull_data.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      84fbfe02
    • John Fastabend's avatar
      bpf: libbpf support for msg_push_data · f908d26b
      John Fastabend authored
      Add support for new bpf_msg_push_data in libbpf.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      f908d26b
    • John Fastabend's avatar
      bpf: sk_msg program helper bpf_msg_push_data · 6fff607e
      John Fastabend authored
      This allows user to push data into a msg using sk_msg program types.
      The format is as follows,
      
      	bpf_msg_push_data(msg, offset, len, flags)
      
      this will insert 'len' bytes at offset 'offset'. For example to
      prepend 10 bytes at the front of the message the user can,
      
      	bpf_msg_push_data(msg, 0, 10, 0);
      
      This will invalidate data bounds so BPF user will have to then recheck
      data bounds after calling this. After this the msg size will have been
      updated and the user is free to write into the added bytes. We allow
      any offset/len as long as it is within the (data, data_end) range.
      However, a copy will be required if the ring is full and its possible
      for the helper to fail with ENOMEM or EINVAL errors which need to be
      handled by the BPF program.
      
      This can be used similar to XDP metadata to pass data between sk_msg
      layer and lower layers.
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      6fff607e