1. 13 9月, 2018 4 次提交
  2. 10 8月, 2018 7 次提交
  3. 22 7月, 2018 11 次提交
  4. 13 7月, 2018 10 次提交
  5. 30 6月, 2018 6 次提交
    • J
      s390/qeth: consistently re-enable device features · d025da9e
      Julian Wiedmann 提交于
      commit e830baa9 ("qeth: restore device features after recovery") and
      commit ce344356 ("s390/qeth: rely on kernel for feature recovery")
      made sure that the HW functions for device features get re-programmed
      after recovery.
      
      But we missed that the same handling is also required when a card is
      first set offline (destroying all HW context), and then online again.
      Fix this by moving the re-enable action out of the recovery-only path.
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d025da9e
    • J
      s390/qeth: don't clobber buffer on async TX completion · ce28867f
      Julian Wiedmann 提交于
      If qeth_qdio_output_handler() detects that a transmit requires async
      completion, it replaces the pending buffer's metadata object
      (qeth_qdio_out_buffer) so that this queue buffer can be re-used while
      the data is pending completion.
      
      Later when the CQ indicates async completion of such a metadata object,
      qeth_qdio_cq_handler() tries to free any data associated with this
      object (since HW has now completed the transfer). By calling
      qeth_clear_output_buffer(), it erronously operates on the queue buffer
      that _previously_ belonged to this transfer ... but which has been
      potentially re-used several times by now.
      This results in double-free's of the buffer's data, and failing
      transmits as the buffer descriptor is scrubbed in mid-air.
      
      The correct way of handling this situation is to
      1. scrub the queue buffer when it is prepared for re-use, and
      2. later obtain the data addresses from the async-completion notifier
         (ie. the AOB), instead of the queue buffer.
      
      All this only affects qeth devices used for af_iucv HiperTransport.
      
      Fixes: 0da9581d ("qeth: exploit asynchronous delivery of storage blocks")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce28867f
    • V
      s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6] · 9d0a58fb
      Vasily Gorbik 提交于
      *ether_addr*_64bits functions have been introduced to optimize
      performance critical paths, which access 6-byte ethernet address as u64
      value to get "nice" assembly. A harmless hack works nicely on ethernet
      addresses shoved into a structure or a larger buffer, until busted by
      Kasan on smth like plain (u8 *)[6].
      
      qeth_l2_set_mac_address calls qeth_l2_remove_mac passing
      u8 old_addr[ETH_ALEN] as an argument.
      
      Adding/removing macs for an ethernet adapter is not that performance
      critical. Moreover is_multicast_ether_addr_64bits itself on s390 is not
      faster than is_multicast_ether_addr:
      
      is_multicast_ether_addr(%r2) -> %r2
      llc	%r2,0(%r2)
      risbg	%r2,%r2,63,191,0
      
      is_multicast_ether_addr_64bits(%r2) -> %r2
      llgc	%r2,0(%r2)
      risbg	%r2,%r2,63,191,0
      
      So, let's just use is_multicast_ether_addr instead of
      is_multicast_ether_addr_64bits.
      
      Fixes: bcacfcbc ("s390/qeth: fix MAC address update sequence")
      Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9d0a58fb
    • J
      s390/qeth: fix race when setting MAC address · 4789a218
      Julian Wiedmann 提交于
      When qeth_l2_set_mac_address() finds the card in a non-reachable state,
      it merely copies the new MAC address into dev->dev_addr so that
      __qeth_l2_set_online() can later register it with the HW.
      
      But __qeth_l2_set_online() may very well be running concurrently, so we
      can't trust the card state without appropriate locking:
      If the online sequence is past the point where it registers
      dev->dev_addr (but not yet in SOFTSETUP state), any address change needs
      to be properly programmed into the HW. Otherwise the netdevice ends up
      with a different MAC address than what's set in the HW, and inbound
      traffic is not forwarded as expected.
      
      This is most likely to occur for OSD in LPAR, where
      commit 21b1702a ("s390/qeth: improve fallback to random MAC address")
      now triggers eg. systemd to immediately change the MAC when the netdevice
      is registered with a NET_ADDR_RANDOM address.
      
      Fixes: bcacfcbc ("s390/qeth: fix MAC address update sequence")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4789a218
    • J
      Revert "s390/qeth: use Read device to query hypervisor for MAC" · 46646105
      Julian Wiedmann 提交于
      This reverts commit b7493e91.
      
      On its own, querying RDEV for a MAC address works fine. But when upgrading
      from a qeth that previously queried DDEV on a z/VM NIC (ie. any kernel with
      commit ec61bd2f), the RDEV query now returns a _different_ MAC address
      than the DDEV query.
      
      If the NIC is configured with MACPROTECT, z/VM apparently requires us to
      use the MAC that was initially returned (on DDEV) and registered. So after
      upgrading to a kernel that uses RDEV, the SETVMAC registration cmd for the
      new MAC address fails and we end up with a non-operabel interface.
      
      To avoid regressions on upgrade, switch back to using DDEV for the MAC
      address query. The downgrade path (first RDEV, later DDEV) is fine, in this
      case both queries return the same MAC address.
      
      Fixes: b7493e91 ("s390/qeth: use Read device to query hypervisor for MAC")
      Reported-by: NMichal Kubecek <mkubecek@suse.com>
      Tested-by: NKarsten Graul <kgraul@linux.ibm.com>
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      46646105
    • S
      s390/ism: add device driver for internal shared memory · 684b89bc
      Sebastian Ott 提交于
      Add support for the Internal Shared Memory vPCI Adapter.
      This driver implements the interfaces of the SMC-D protocol.
      Signed-off-by: NSebastian Ott <sebott@linux.ibm.com>
      Signed-off-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      684b89bc
  6. 13 6月, 2018 1 次提交
    • K
      treewide: kzalloc() -> kcalloc() · 6396bb22
      Kees Cook 提交于
      The kzalloc() function has a 2-factor argument form, kcalloc(). This
      patch replaces cases of:
      
              kzalloc(a * b, gfp)
      
      with:
              kcalloc(a * b, gfp)
      
      as well as handling cases of:
      
              kzalloc(a * b * c, gfp)
      
      with:
      
              kzalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kzalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kzalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kzalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kzalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kzalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kzalloc
      + kcalloc
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kzalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(sizeof(THING) * C2, ...)
      |
        kzalloc(sizeof(TYPE) * C2, ...)
      |
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(C1 * C2, ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6396bb22
  7. 28 4月, 2018 1 次提交