1. 10 Oct, 2020 8 commits
    • Jakub Kicinski's avatar
      Merge branch 'netlink-export-policy-on-validation-failures' · c77fb07f
      Jakub Kicinski authored
      Johannes Berg says:
      
      ====================
      netlink: export policy on validation failures
      
      Export the policy used for attribute validation when it fails,
      so e.g. for an out-of-range attribute userspace immediately gets
      the valid ranges back.
      
      v2 incorporates the suggestion from Jakub to have a function to
      estimate the size (netlink_policy_dump_attr_size_estimate()) and
      check that it does the right thing on the *normal* policy dumps,
      not (just) when calling it from the error scenario.
      
      v3 only addresses a few minor style issues.
      
      v4 fixes up a forgotten 'git add' ... sorry.
      
      v5 is a resend, I messed up v4's cover letter subject (saying v3)
      and apparently the second patch didn't go out at all.
      
      Tested using nl80211/iw in a few scenarios, seems to work fine
      and return the policy back, e.g.
      
      kernel reports: integer out of range
      policy: 04 00 0b 00 0c 00 04 00 01 00 00 00 00 00 00 00
              ^ padding
                          ^ minimum allowed value
      policy: 04 00 0b 00 0c 00 05 00 ff ff ff ff 00 00 00 00
              ^ padding
                          ^ maximum allowed value
      policy: 08 00 01 00 04 00 00 00
              ^ type 4 == U32
      
      for an out-of-range case.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c77fb07f
    • Johannes Berg's avatar
      netlink: export policy in extended ACK · 44f3625b
      Johannes Berg authored
      Add a new attribute NLMSGERR_ATTR_POLICY to the extended ACK
      to advertise the policy, e.g. if an attribute was out of range,
      you'll know the range that's permissible.
      
      Add new NL_SET_ERR_MSG_ATTR_POL() and NL_SET_ERR_MSG_ATTR_POL()
      macros to set this, since realistically it's only useful to do
      this when the bad attribute (offset) is also returned.
      
      Use it in lib/nlattr.c which practically does all the policy
      validation.
      
      v2:
       - add and use netlink_policy_dump_attr_size_estimate()
      v3:
       - remove redundant break
      v4:
       - really remove redundant break ... sorry
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      44f3625b
    • Johannes Berg's avatar
      netlink: policy: refactor per-attr policy writing · d2681e93
      Johannes Berg authored
      Refactor the per-attribute policy writing into a new
      helper function, to be used later for dumping out the
      policy of a rejected attribute.
      
      v2:
       - fix some indentation
      v3:
       - change variable order in netlink_policy_dump_write()
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d2681e93
    • Jakub Kicinski's avatar
      Merge branch 'net-smc-updates-2020-10-07' · c4cc0b9c
      Jakub Kicinski authored
      Karsten Graul says:
      
      ====================
      net/smc: updates 2020-10-07
      
      Patch 1 and 2 address warnings from static code checkers, and patch 3
      handles a case when all proposed ISM V2 devices fail to init and no V1
      devices are tried afterwards.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c4cc0b9c
    • Karsten Graul's avatar
      net/smc: restore smcd_version when all ISM V2 devices failed to init · f29fa003
      Karsten Graul authored
      Field ini->smcd_version is set to SMC_V2 before calling
      smc_listen_ism_init(). This clears the V1 bit that may be set. When all
      matching ISM V2 devices fail to initialize then the smcd_version field
      needs to get restored to allow any possible V1 devices to initialize.
      And be consistent, always go to the not_found label when no device was
      found.
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f29fa003
    • Karsten Graul's avatar
      net/smc: cleanup buffer usage in smc_listen_work() · 9047a617
      Karsten Graul authored
      coccinelle informs about
      net/smc/af_smc.c:1770:10-11: WARNING: opportunity for kzfree/kvfree_sensitive
      
      Its not that kzfree() would help here, the memset() is done to prepare
      the buffer for another socket receive.
      Fix that warning message by reordering the calls, while at it eliminate
      the unneeded variable cclc2 and use sizeof(*buf) as above in the same
      function. No functional changes.
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9047a617
    • Karsten Graul's avatar
      net/smc: consolidate unlocking in same function · c60a2cef
      Karsten Graul authored
      Static code checkers warn of inconsistent returns because the lgr mutex
      is locked in one function and unlocked in a function called by the
      locking function:
      net/smc/af_smc.c:823 smc_connect_rdma() warn: inconsistent returns 'smc_client_lgr_pending'.
      net/smc/af_smc.c:897 smc_connect_ism() warn: inconsistent returns 'smc_server_lgr_pending'.
      
      Make the code consistent by doing the unlock in the same function that
      fetches the lock. No functional changes.
      Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c60a2cef
    • Jakub Kicinski's avatar
      Merge tag 'linux-can-next-for-5.10-20201007' of... · 8f5e71b9
      Jakub Kicinski authored
      Merge tag 'linux-can-next-for-5.10-20201007' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
      
      Marc Kleine-Budde says:
      
      ====================
      linux-can-next-for-5.10-20201007
      
      The first 3 patches are by me and fix several warnings found
      when compiling the  kernel with W=1.
      
      Lukas Bulwahn's patch adjusts the MAINTAINERS file, to accommodate
      the renaming of the mcp251xfd driver.
      
      Vincent Mailhol contributes 3 patches for the CAN networking layer.
      First error queue support is added the the CAN RAW protocol.
      The second patch converts the get_can_dlc() and get_canfd_dlc()
      in-Kernel-only macros from using __u8 to u8.
      The third patch adds a helper function to calculate the length of
      one bit in in multiple of time quanta.
      
      Oliver Hartkopp's patch add support for the ISO 15765-2:2016
      transport protocol to the CAN stack.
      
      Three patches by Lad Prabhakar add documentation for various
      new rcar controllers to the device tree bindings of the rcar_can
      and rcan_canfd driver.
      
      Michael Walle's patch adds various processors to the flexcan
      driver binding documentation.
      
      The next two patches are by me and target the flexcan driver aswell.
      The remove the ack_grp and ack_bit from the fsl,stop-mode DT property
      and the driver, as they are not used anymore. As these are the last
      two arguments this change will not break existing device trees.
      
      The last three patches are by Srinivas Neeli and target
      the xilinx_can driver.
      The first one increases the lower limit for the bit rate
      prescaler to 2, the other two fix sparse and coverity findings.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8f5e71b9
  2. 09 Oct, 2020 32 commits