1. 16 4月, 2019 1 次提交
  2. 06 4月, 2019 2 次提交
    • B
      hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable · a6c671e2
      Buland Singh 提交于
      [ Upstream commit 24d48a61f2666630da130cc2ec2e526eacf229e3 ]
      
      Commit '3d035f58 ("drivers/char/hpet.c: allow user controlled mmap for
      user processes")' introduced a new kernel command line parameter hpet_mmap,
      that is required to expose the memory map of the HPET registers to
      user-space. Unfortunately the kernel command line parameter 'hpet_mmap' is
      broken and never takes effect due to missing '=' character in the __setup()
      code of hpet_mmap_enable.
      
      Before this patch:
      
      dmesg output with the kernel command line parameter hpet_mmap=1
      
      [    0.204152] HPET mmap disabled
      
      dmesg output with the kernel command line parameter hpet_mmap=0
      
      [    0.204192] HPET mmap disabled
      
      After this patch:
      
      dmesg output with the kernel command line parameter hpet_mmap=1
      
      [    0.203945] HPET mmap enabled
      
      dmesg output with the kernel command line parameter hpet_mmap=0
      
      [    0.204652] HPET mmap disabled
      
      Fixes: 3d035f58 ("drivers/char/hpet.c: allow user controlled mmap for user processes")
      Signed-off-by: NBuland Singh <bsingh@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a6c671e2
    • D
      hwrng: virtio - Avoid repeated init of completion · a3aa9d93
      David Tolnay 提交于
      [ Upstream commit aef027db48da56b6f25d0e54c07c8401ada6ce21 ]
      
      The virtio-rng driver uses a completion called have_data to wait for a
      virtio read to be fulfilled by the hypervisor. The completion is reset
      before placing a buffer on the virtio queue and completed by the virtio
      callback once data has been written into the buffer.
      
      Prior to this commit, the driver called init_completion on this
      completion both during probe as well as when registering virtio buffers
      as part of a hwrng read operation. The second of these init_completion
      calls should instead be reinit_completion because the have_data
      completion has already been inited by probe. As described in
      Documentation/scheduler/completion.txt, "Calling init_completion() twice
      on the same completion object is most likely a bug".
      
      This bug was present in the initial implementation of virtio-rng in
      f7f510ec ("virtio: An entropy device, as suggested by hpa"). Back
      then the have_data completion was a single static completion rather than
      a member of one of potentially multiple virtrng_info structs as
      implemented later by 08e53fbd ("virtio-rng: support multiple
      virtio-rng devices"). The original driver incorrectly used
      init_completion rather than INIT_COMPLETION to reset have_data during
      read.
      
      Tested by running `head -c48 /dev/random | hexdump` within crosvm, the
      Chrome OS virtual machine monitor, and confirming that the virtio-rng
      driver successfully produces random bytes from the host.
      Signed-off-by: NDavid Tolnay <dtolnay@gmail.com>
      Tested-by: NDavid Tolnay <dtolnay@gmail.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a3aa9d93
  3. 03 4月, 2019 1 次提交
    • C
      ipmi_si: Fix crash when using hard-coded device · 6bba17f6
      Corey Minyard 提交于
      Backport from 41b766d661bf94a364960862cfc248a78313dbd3
      
      When excuting a command like:
        modprobe ipmi_si ports=0xffc0e3 type=bt
      The system would get an oops.
      
      The trouble here is that ipmi_si_hardcode_find_bmc() is called before
      ipmi_si_platform_init(), but initialization of the hard-coded device
      creates an IPMI platform device, which won't be initialized yet.
      
      The real trouble is that hard-coded devices aren't created with
      any device, and the fixup is done later.  So do it right, create the
      hard-coded devices as normal platform devices.
      
      This required adding some new resource types to the IPMI platform
      code for passing information required by the hard-coded device
      and adding some code to remove the hard-coded platform devices
      on module removal.
      
      To enforce the "hard-coded devices passed by the user take priority
      over firmware devices" rule, some special code was added to check
      and see if a hard-coded device already exists.
      
      The backport required some minor fixups and adding the device
      id table that had been added in another change and was used
      in this one.
      Reported-by: NYang Yingliang <yangyingliang@huawei.com>
      Cc: stable@vger.kernel.org # v4.15+
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Tested-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6bba17f6
  4. 24 3月, 2019 3 次提交
    • J
      tpm: Unify the send callback behaviour · bce45a54
      Jarkko Sakkinen 提交于
      commit f5595f5baa30e009bf54d0d7653a9a0cc465be60 upstream.
      
      The send() callback should never return length as it does not in every
      driver except tpm_crb in the success case. The reason is that the main
      transmit functionality only cares about whether the transmit was
      successful or not and ignores the count completely.
      Suggested-by: NStefan Berger <stefanb@linux.ibm.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Reviewed-by: NStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: NJerry Snitselaar <jsnitsel@redhat.com>
      Tested-by: NAlexander Steffen <Alexander.Steffen@infineon.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bce45a54
    • J
      tpm/tpm_crb: Avoid unaligned reads in crb_recv() · af0c1bd0
      Jarkko Sakkinen 提交于
      commit 3d7a850fdc1a2e4d2adbc95cc0fc962974725e88 upstream.
      
      The current approach to read first 6 bytes from the response and then tail
      of the response, can cause the 2nd memcpy_fromio() to do an unaligned read
      (e.g. read 32-bit word from address aligned to a 16-bits), depending on how
      memcpy_fromio() is implemented. If this happens, the read will fail and the
      memory controller will fill the read with 1's.
      
      This was triggered by 170d13ca3a2f, which should be probably refined to
      check and react to the address alignment. Before that commit, on x86
      memcpy_fromio() turned out to be memcpy(). By a luck GCC has done the right
      thing (from tpm_crb's perspective) for us so far, but we should not rely on
      that. Thus, it makes sense to fix this also in tpm_crb, not least because
      the fix can be then backported to stable kernels and make them more robust
      when compiled in differing environments.
      
      Cc: stable@vger.kernel.org
      Cc: James Morris <jmorris@namei.org>
      Cc: Tomas Winkler <tomas.winkler@intel.com>
      Cc: Jerry Snitselaar <jsnitsel@redhat.com>
      Fixes: 30fc8d13 ("tpm: TPM 2.0 CRB Interface")
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Reviewed-by: NJerry Snitselaar <jsnitsel@redhat.com>
      Acked-by: NTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af0c1bd0
    • Y
      ipmi_si: fix use-after-free of resource->name · a441fdaf
      Yang Yingliang 提交于
      commit 401e7e88d4ef80188ffa07095ac00456f901b8c4 upstream.
      
      When we excute the following commands, we got oops
      rmmod ipmi_si
      cat /proc/ioports
      
      [ 1623.482380] Unable to handle kernel paging request at virtual address ffff00000901d478
      [ 1623.482382] Mem abort info:
      [ 1623.482383]   ESR = 0x96000007
      [ 1623.482385]   Exception class = DABT (current EL), IL = 32 bits
      [ 1623.482386]   SET = 0, FnV = 0
      [ 1623.482387]   EA = 0, S1PTW = 0
      [ 1623.482388] Data abort info:
      [ 1623.482389]   ISV = 0, ISS = 0x00000007
      [ 1623.482390]   CM = 0, WnR = 0
      [ 1623.482393] swapper pgtable: 4k pages, 48-bit VAs, pgdp = 00000000d7d94a66
      [ 1623.482395] [ffff00000901d478] pgd=000000dffbfff003, pud=000000dffbffe003, pmd=0000003f5d06e003, pte=0000000000000000
      [ 1623.482399] Internal error: Oops: 96000007 [#1] SMP
      [ 1623.487407] Modules linked in: ipmi_si(E) nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm dm_mirror dm_region_hash dm_log iw_cm dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ses ghash_ce sha2_ce enclosure sha256_arm64 sg sha1_ce hisi_sas_v2_hw hibmc_drm sbsa_gwdt hisi_sas_main ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe mdio hns_dsaf ipmi_devintf hns_enet_drv ipmi_msghandler hns_mdio [last unloaded: ipmi_si]
      [ 1623.532410] CPU: 30 PID: 11438 Comm: cat Kdump: loaded Tainted: G            E     5.0.0-rc3+ #168
      [ 1623.541498] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017
      [ 1623.548822] pstate: a0000005 (NzCv daif -PAN -UAO)
      [ 1623.553684] pc : string+0x28/0x98
      [ 1623.557040] lr : vsnprintf+0x368/0x5e8
      [ 1623.560837] sp : ffff000013213a80
      [ 1623.564191] x29: ffff000013213a80 x28: ffff00001138abb5
      [ 1623.569577] x27: ffff000013213c18 x26: ffff805f67d06049
      [ 1623.574963] x25: 0000000000000000 x24: ffff00001138abb5
      [ 1623.580349] x23: 0000000000000fb7 x22: ffff0000117ed000
      [ 1623.585734] x21: ffff000011188fd8 x20: ffff805f67d07000
      [ 1623.591119] x19: ffff805f67d06061 x18: ffffffffffffffff
      [ 1623.596505] x17: 0000000000000200 x16: 0000000000000000
      [ 1623.601890] x15: ffff0000117ed748 x14: ffff805f67d07000
      [ 1623.607276] x13: ffff805f67d0605e x12: 0000000000000000
      [ 1623.612661] x11: 0000000000000000 x10: 0000000000000000
      [ 1623.618046] x9 : 0000000000000000 x8 : 000000000000000f
      [ 1623.623432] x7 : ffff805f67d06061 x6 : fffffffffffffffe
      [ 1623.628817] x5 : 0000000000000012 x4 : ffff00000901d478
      [ 1623.634203] x3 : ffff0a00ffffff04 x2 : ffff805f67d07000
      [ 1623.639588] x1 : ffff805f67d07000 x0 : ffffffffffffffff
      [ 1623.644974] Process cat (pid: 11438, stack limit = 0x000000008d4cbc10)
      [ 1623.651592] Call trace:
      [ 1623.654068]  string+0x28/0x98
      [ 1623.657071]  vsnprintf+0x368/0x5e8
      [ 1623.660517]  seq_vprintf+0x70/0x98
      [ 1623.668009]  seq_printf+0x7c/0xa0
      [ 1623.675530]  r_show+0xc8/0xf8
      [ 1623.682558]  seq_read+0x330/0x440
      [ 1623.689877]  proc_reg_read+0x78/0xd0
      [ 1623.697346]  __vfs_read+0x60/0x1a0
      [ 1623.704564]  vfs_read+0x94/0x150
      [ 1623.711339]  ksys_read+0x6c/0xd8
      [ 1623.717939]  __arm64_sys_read+0x24/0x30
      [ 1623.725077]  el0_svc_common+0x120/0x148
      [ 1623.732035]  el0_svc_handler+0x30/0x40
      [ 1623.738757]  el0_svc+0x8/0xc
      [ 1623.744520] Code: d1000406 aa0103e2 54000149 b4000080 (39400085)
      [ 1623.753441] ---[ end trace f91b6a4937de9835 ]---
      [ 1623.760871] Kernel panic - not syncing: Fatal exception
      [ 1623.768935] SMP: stopping secondary CPUs
      [ 1623.775718] Kernel Offset: disabled
      [ 1623.781998] CPU features: 0x002,21006008
      [ 1623.788777] Memory Limit: none
      [ 1623.798329] Starting crashdump kernel...
      [ 1623.805202] Bye!
      
      If io_setup is called successful in try_smi_init() but try_smi_init()
      goes out_err before calling ipmi_register_smi(), so ipmi_unregister_smi()
      will not be called while removing module. It leads to the resource that
      allocated in io_setup() can not be freed, but the name(DEVICE_NAME) of
      resource is freed while removing the module. It causes use-after-free
      when cat /proc/ioports.
      
      Fix this by calling io_cleanup() while try_smi_init() goes to out_err.
      and don't call io_cleanup() until io_setup() returns successful to avoid
      warning prints.
      
      Fixes: 93c303d2 ("ipmi_si: Clean up shutdown a bit")
      Cc: stable@vger.kernel.org
      Reported-by: NNuoHan Qiao <qiaonuohan@huawei.com>
      Suggested-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a441fdaf
  5. 10 3月, 2019 1 次提交
  6. 31 1月, 2019 1 次提交
  7. 26 1月, 2019 5 次提交
    • C
      ipmi: Don't initialize anything in the core until something uses it · b40aec33
      Corey Minyard 提交于
      commit 913a89f009d98c85a902d718cd54bb32ab11d167 upstream.
      
      The IPMI driver was recently modified to use SRCU, but it turns out
      this uses a chunk of percpu memory, even if IPMI is never used.
      
      So modify thing to on initialize on the first use.  There was already
      code to sort of handle this for handling init races, so piggy back
      on top of that, and simplify it in the process.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reported-by: NTejun Heo <tj@kernel.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Reviewed-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org # 4.18
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b40aec33
    • C
      ipmi:ssif: Fix handling of multi-part return messages · 031a94ff
      Corey Minyard 提交于
      commit 7d6380cd40f7993f75c4bde5b36f6019237e8719 upstream.
      
      The block number was not being compared right, it was off by one
      when checking the response.
      
      Some statistics wouldn't be incremented properly in some cases.
      
      Check to see if that middle-part messages always have 31 bytes of
      data.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Cc: stable@vger.kernel.org # 4.4
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      031a94ff
    • F
      ipmi: Prevent use-after-free in deliver_response · 821a003d
      Fred Klassen 提交于
      commit 479d6b39b9e0d2de648ebf146f23a1e40962068f upstream.
      
      Some IPMI modules (e.g. ibmpex_msg_handler()) will have ipmi_usr_hdlr
      handlers that call ipmi_free_recv_msg() directly. This will essentially
      kfree(msg), leading to use-after-free.
      
      This does not happen in the ipmi_devintf module, which will queue the
      message and run ipmi_free_recv_msg() later.
      
      BUG: KASAN: use-after-free in deliver_response+0x12f/0x1b0
      Read of size 8 at addr ffff888a7bf20018 by task ksoftirqd/3/27
      CPU: 3 PID: 27 Comm: ksoftirqd/3 Tainted: G           O      4.19.11-amd64-ani99-debug #12.0.1.601133+pv
      Hardware name: AppNeta r1000/X11SPW-TF, BIOS 2.1a-AP 09/17/2018
      Call Trace:
      dump_stack+0x92/0xeb
      print_address_description+0x73/0x290
      kasan_report+0x258/0x380
      deliver_response+0x12f/0x1b0
      ? ipmi_free_recv_msg+0x50/0x50
      deliver_local_response+0xe/0x50
      handle_one_recv_msg+0x37a/0x21d0
      handle_new_recv_msgs+0x1ce/0x440
      ...
      
      Allocated by task 9885:
      kasan_kmalloc+0xa0/0xd0
      kmem_cache_alloc_trace+0x116/0x290
      ipmi_alloc_recv_msg+0x28/0x70
      i_ipmi_request+0xb4a/0x1640
      ipmi_request_settime+0x1b8/0x1e0
      ...
      
      Freed by task 27:
      __kasan_slab_free+0x12e/0x180
      kfree+0xe9/0x280
      deliver_response+0x122/0x1b0
      deliver_local_response+0xe/0x50
      handle_one_recv_msg+0x37a/0x21d0
      handle_new_recv_msgs+0x1ce/0x440
      tasklet_action_common.isra.19+0xc4/0x250
      __do_softirq+0x11f/0x51f
      
      Fixes: e86ee2d4 ("ipmi: Rework locking and shutdown for hot remove")
      Cc: stable@vger.kernel.org # 4.18
      Signed-off-by: NFred Klassen <fklassen@appneta.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      821a003d
    • G
      ipmi: msghandler: Fix potential Spectre v1 vulnerabilities · 753abe2a
      Gustavo A. R. Silva 提交于
      commit a7102c7461794a5bb31af24b08e9e0f50038897a upstream.
      
      channel and addr->channel are indirectly controlled by user-space,
      hence leading to a potential exploitation of the Spectre variant 1
      vulnerability.
      
      These issues were detected with the help of Smatch:
      
      drivers/char/ipmi/ipmi_msghandler.c:1381 ipmi_set_my_address() warn: potential spectre issue 'user->intf->addrinfo' [w] (local cap)
      drivers/char/ipmi/ipmi_msghandler.c:1401 ipmi_get_my_address() warn: potential spectre issue 'user->intf->addrinfo' [r] (local cap)
      drivers/char/ipmi/ipmi_msghandler.c:1421 ipmi_set_my_LUN() warn: potential spectre issue 'user->intf->addrinfo' [w] (local cap)
      drivers/char/ipmi/ipmi_msghandler.c:1441 ipmi_get_my_LUN() warn: potential spectre issue 'user->intf->addrinfo' [r] (local cap)
      drivers/char/ipmi/ipmi_msghandler.c:2260 check_addr() warn: potential spectre issue 'intf->addrinfo' [r] (local cap)
      
      Fix this by sanitizing channel and addr->channel before using them to
      index user->intf->addrinfo and intf->addrinfo, correspondingly.
      
      Notice that given that speculation windows are large, the policy is
      to kill the speculation on the first load and not worry if it can be
      completed with a dependent load/store [1].
      
      [1] https://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      753abe2a
    • Y
      ipmi: fix use-after-free of user->release_barrier.rda · 1c393ca1
      Yang Yingliang 提交于
      commit 77f8269606bf95fcb232ee86f6da80886f1dfae8 upstream.
      
      When we do the following test, we got oops in ipmi_msghandler driver
      while((1))
      do
      	service ipmievd restart & service ipmievd restart
      done
      
      ---------------------------------------------------------------
      [  294.230186] Unable to handle kernel paging request at virtual address 0000803fea6ea008
      [  294.230188] Mem abort info:
      [  294.230190]   ESR = 0x96000004
      [  294.230191]   Exception class = DABT (current EL), IL = 32 bits
      [  294.230193]   SET = 0, FnV = 0
      [  294.230194]   EA = 0, S1PTW = 0
      [  294.230195] Data abort info:
      [  294.230196]   ISV = 0, ISS = 0x00000004
      [  294.230197]   CM = 0, WnR = 0
      [  294.230199] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000a1c1b75a
      [  294.230201] [0000803fea6ea008] pgd=0000000000000000
      [  294.230204] Internal error: Oops: 96000004 [#1] SMP
      [  294.235211] Modules linked in: nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm iw_cm dm_mirror dm_region_hash dm_log dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce sha2_ce ses sha256_arm64 sha1_ce hibmc_drm hisi_sas_v2_hw enclosure sg hisi_sas_main sbsa_gwdt ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe ipmi_si mdio hns_dsaf ipmi_devintf ipmi_msghandler hns_enet_drv hns_mdio
      [  294.277745] CPU: 3 PID: 0 Comm: swapper/3 Kdump: loaded Not tainted 5.0.0-rc2+ #113
      [  294.285511] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017
      [  294.292835] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [  294.297695] pc : __srcu_read_lock+0x38/0x58
      [  294.301940] lr : acquire_ipmi_user+0x2c/0x70 [ipmi_msghandler]
      [  294.307853] sp : ffff00001001bc80
      [  294.311208] x29: ffff00001001bc80 x28: ffff0000117e5000
      [  294.316594] x27: 0000000000000000 x26: dead000000000100
      [  294.321980] x25: dead000000000200 x24: ffff803f6bd06800
      [  294.327366] x23: 0000000000000000 x22: 0000000000000000
      [  294.332752] x21: ffff00001001bd04 x20: ffff80df33d19018
      [  294.338137] x19: ffff80df33d19018 x18: 0000000000000000
      [  294.343523] x17: 0000000000000000 x16: 0000000000000000
      [  294.348908] x15: 0000000000000000 x14: 0000000000000002
      [  294.354293] x13: 0000000000000000 x12: 0000000000000000
      [  294.359679] x11: 0000000000000000 x10: 0000000000100000
      [  294.365065] x9 : 0000000000000000 x8 : 0000000000000004
      [  294.370451] x7 : 0000000000000000 x6 : ffff80df34558678
      [  294.375836] x5 : 000000000000000c x4 : 0000000000000000
      [  294.381221] x3 : 0000000000000001 x2 : 0000803fea6ea000
      [  294.386607] x1 : 0000803fea6ea008 x0 : 0000000000000001
      [  294.391994] Process swapper/3 (pid: 0, stack limit = 0x0000000083087293)
      [  294.398791] Call trace:
      [  294.401266]  __srcu_read_lock+0x38/0x58
      [  294.405154]  acquire_ipmi_user+0x2c/0x70 [ipmi_msghandler]
      [  294.410716]  deliver_response+0x80/0xf8 [ipmi_msghandler]
      [  294.416189]  deliver_local_response+0x28/0x68 [ipmi_msghandler]
      [  294.422193]  handle_one_recv_msg+0x158/0xcf8 [ipmi_msghandler]
      [  294.432050]  handle_new_recv_msgs+0xc0/0x210 [ipmi_msghandler]
      [  294.441984]  smi_recv_tasklet+0x8c/0x158 [ipmi_msghandler]
      [  294.451618]  tasklet_action_common.isra.5+0x88/0x138
      [  294.460661]  tasklet_action+0x2c/0x38
      [  294.468191]  __do_softirq+0x120/0x2f8
      [  294.475561]  irq_exit+0x134/0x140
      [  294.482445]  __handle_domain_irq+0x6c/0xc0
      [  294.489954]  gic_handle_irq+0xb8/0x178
      [  294.497037]  el1_irq+0xb0/0x140
      [  294.503381]  arch_cpu_idle+0x34/0x1a8
      [  294.510096]  do_idle+0x1d4/0x290
      [  294.516322]  cpu_startup_entry+0x28/0x30
      [  294.523230]  secondary_start_kernel+0x184/0x1d0
      [  294.530657] Code: d538d082 d2800023 8b010c81 8b020021 (c85f7c25)
      [  294.539746] ---[ end trace 8a7a880dee570b29 ]---
      [  294.547341] Kernel panic - not syncing: Fatal exception in interrupt
      [  294.556837] SMP: stopping secondary CPUs
      [  294.563996] Kernel Offset: disabled
      [  294.570515] CPU features: 0x002,21006008
      [  294.577638] Memory Limit: none
      [  294.587178] Starting crashdump kernel...
      [  294.594314] Bye!
      
      Because the user->release_barrier.rda is freed in ipmi_destroy_user(), but
      the refcount is not zero, when acquire_ipmi_user() uses user->release_barrier.rda
      in __srcu_read_lock(), it causes oops.
      Fix this by calling cleanup_srcu_struct() when the refcount is zero.
      
      Fixes: e86ee2d4 ("ipmi: Rework locking and shutdown for hot remove")
      Cc: stable@vger.kernel.org # 4.18
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c393ca1
  8. 10 1月, 2019 2 次提交
  9. 14 11月, 2018 4 次提交
    • J
      tpm: fix response size validation in tpm_get_random() · c6d2e202
      Jarkko Sakkinen 提交于
      commit 84b59f6487d82d3ab4247a099aba66d4d17e8b08 upstream.
      
      When checking whether the response is large enough to be able to contain
      the received random bytes in tpm_get_random() and tpm2_get_random(),
      they fail to take account the header size, which should be added to the
      minimum size. This commit fixes this issue.
      
      Cc: stable@vger.kernel.org
      Fixes: c659af78 ("tpm: Check size of response before accessing data")
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6d2e202
    • D
      tpm: Restore functionality to xen vtpm driver. · 4eab852b
      Dr. Greg Wettstein 提交于
      commit e487a0f5 upstream.
      
      Functionality of the xen-tpmfront driver was lost secondary to
      the introduction of xenbus multi-page support in commit ccc9d90a
      ("xenbus_client: Extend interface to support multi-page ring").
      
      In this commit pointer to location of where the shared page address
      is stored was being passed to the xenbus_grant_ring() function rather
      then the address of the shared page itself. This resulted in a situation
      where the driver would attach to the vtpm-stubdom but any attempt
      to send a command to the stub domain would timeout.
      
      A diagnostic finding for this regression is the following error
      message being generated when the xen-tpmfront driver probes for a
      device:
      
      <3>vtpm vtpm-0: tpm_transmit: tpm_send: error -62
      
      <3>vtpm vtpm-0: A TPM error (-62) occurred attempting to determine
      the timeouts
      
      This fix is relevant to all kernels from 4.1 forward which is the
      release in which multi-page xenbus support was introduced.
      
      Daniel De Graaf formulated the fix by code inspection after the
      regression point was located.
      
      Fixes: ccc9d90a ("xenbus_client: Extend interface to support multi-page ring")
      Signed-off-by: NDr. Greg Wettstein <greg@enjellic.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      [boris: Updated commit message, added Fixes tag]
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: stable@vger.kernel.org # v4.1+
      Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      4eab852b
    • J
      tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated · f4b5f439
      Javier Martinez Canillas 提交于
      [ Upstream commit 0d6d0d62 ]
      
      For TPM 1.2 chips the system setup utility allows to set the TPM device in
      one of the following states:
      
        * Active: Security chip is functional
        * Inactive: Security chip is visible, but is not functional
        * Disabled: Security chip is hidden and is not functional
      
      When choosing the "Inactive" state, the TPM 1.2 device is enumerated and
      registered, but sending TPM commands fail with either TPM_DEACTIVATED or
      TPM_DISABLED depending if the firmware deactivated or disabled the TPM.
      
      Since these TPM 1.2 error codes don't have special treatment, inactivating
      the TPM leads to a very noisy kernel log buffer that shows messages like
      the following:
      
        tpm_tis 00:05: 1.2 TPM (device-id 0x0, rev-id 78)
        tpm tpm0: A TPM error (6) occurred attempting to read a pcr value
        tpm tpm0: TPM is disabled/deactivated (0x6)
        tpm tpm0: A TPM error (6) occurred attempting get random
        tpm tpm0: A TPM error (6) occurred attempting to read a pcr value
        ima: No TPM chip found, activating TPM-bypass! (rc=6)
        tpm tpm0: A TPM error (6) occurred attempting get random
        tpm tpm0: A TPM error (6) occurred attempting get random
        tpm tpm0: A TPM error (6) occurred attempting get random
        tpm tpm0: A TPM error (6) occurred attempting get random
      
      Let's just suppress error log messages for the TPM_{DEACTIVATED,DISABLED}
      return codes, since this is expected when the TPM 1.2 is set to Inactive.
      
      In that case the kernel log is cleaner and less confusing for users, i.e:
      
        tpm_tis 00:05: 1.2 TPM (device-id 0x0, rev-id 78)
        tpm tpm0: TPM is disabled/deactivated (0x6)
        ima: No TPM chip found, activating TPM-bypass! (rc=6)
      Reported-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4b5f439
    • J
      ipmi: Fix timer race with module unload · 8e071518
      Jan Glauber 提交于
      commit 0711e8c1 upstream.
      
      Please note that below oops is from an older kernel, but the same
      race seems to be present in the upstream kernel too.
      
      ---8<---
      
      The following panic was encountered during removing the ipmi_ssif
      module:
      
      [ 526.352555] Unable to handle kernel paging request at virtual address ffff000006923090
      [ 526.360464] Mem abort info:
      [ 526.363257] ESR = 0x86000007
      [ 526.366304] Exception class = IABT (current EL), IL = 32 bits
      [ 526.372221] SET = 0, FnV = 0
      [ 526.375269] EA = 0, S1PTW = 0
      [ 526.378405] swapper pgtable: 4k pages, 48-bit VAs, pgd = 000000008ae60416
      [ 526.385185] [ffff000006923090] *pgd=000000bffcffe803, *pud=000000bffcffd803, *pmd=0000009f4731a003, *pte=0000000000000000
      [ 526.396141] Internal error: Oops: 86000007 [#1] SMP
      [ 526.401008] Modules linked in: nls_iso8859_1 ipmi_devintf joydev input_leds ipmi_msghandler shpchp sch_fq_codel ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear i2c_smbus hid_generic usbhid uas hid usb_storage ast aes_ce_blk i2c_algo_bit aes_ce_cipher qede ttm crc32_ce ptp crct10dif_ce drm_kms_helper ghash_ce syscopyarea sha2_ce sysfillrect sysimgblt pps_core fb_sys_fops sha256_arm64 sha1_ce mpt3sas qed drm raid_class ahci scsi_transport_sas libahci gpio_xlp i2c_xlp9xx aes_neon_bs aes_neon_blk crypto_simd cryptd aes_arm64 [last unloaded: ipmi_ssif]
      [ 526.468085] CPU: 125 PID: 0 Comm: swapper/125 Not tainted 4.15.0-35-generic #38~lp1775396+build.1
      [ 526.476942] Hardware name: To be filled by O.E.M. Saber/Saber, BIOS 0ACKL022 08/14/2018
      [ 526.484932] pstate: 00400009 (nzcv daif +PAN -UAO)
      [ 526.489713] pc : 0xffff000006923090
      [ 526.493198] lr : call_timer_fn+0x34/0x178
      [ 526.497194] sp : ffff000009b0bdd0
      [ 526.500496] x29: ffff000009b0bdd0 x28: 0000000000000082
      [ 526.505796] x27: 0000000000000002 x26: ffff000009515188
      [ 526.511096] x25: ffff000009515180 x24: ffff0000090f1018
      [ 526.516396] x23: ffff000009519660 x22: dead000000000200
      [ 526.521696] x21: ffff000006923090 x20: 0000000000000100
      [ 526.526995] x19: ffff809eeb466a40 x18: 0000000000000000
      [ 526.532295] x17: 000000000000000e x16: 0000000000000007
      [ 526.537594] x15: 0000000000000000 x14: 071c71c71c71c71c
      [ 526.542894] x13: 0000000000000000 x12: 0000000000000000
      [ 526.548193] x11: 0000000000000001 x10: ffff000009b0be88
      [ 526.553493] x9 : 0000000000000000 x8 : 0000000000000005
      [ 526.558793] x7 : ffff80befc1f8528 x6 : 0000000000000020
      [ 526.564092] x5 : 0000000000000040 x4 : 0000000020001b20
      [ 526.569392] x3 : 0000000000000000 x2 : ffff809eeb466a40
      [ 526.574692] x1 : ffff000006923090 x0 : ffff809eeb466a40
      [ 526.579992] Process swapper/125 (pid: 0, stack limit = 0x000000002eb50acc)
      [ 526.586854] Call trace:
      [ 526.589289] 0xffff000006923090
      [ 526.592419] expire_timers+0xc8/0x130
      [ 526.596070] run_timer_softirq+0xec/0x1b0
      [ 526.600070] __do_softirq+0x134/0x328
      [ 526.603726] irq_exit+0xc8/0xe0
      [ 526.606857] __handle_domain_irq+0x6c/0xc0
      [ 526.610941] gic_handle_irq+0x84/0x188
      [ 526.614679] el1_irq+0xe8/0x180
      [ 526.617822] cpuidle_enter_state+0xa0/0x328
      [ 526.621993] cpuidle_enter+0x34/0x48
      [ 526.625564] call_cpuidle+0x44/0x70
      [ 526.629040] do_idle+0x1b8/0x1f0
      [ 526.632256] cpu_startup_entry+0x2c/0x30
      [ 526.636174] secondary_start_kernel+0x11c/0x130
      [ 526.640694] Code: bad PC value
      [ 526.643800] ---[ end trace d020b0b8417c2498 ]---
      [ 526.648404] Kernel panic - not syncing: Fatal exception in interrupt
      [ 526.654778] SMP: stopping secondary CPUs
      [ 526.658734] Kernel Offset: disabled
      [ 526.662211] CPU features: 0x5800c38
      [ 526.665688] Memory Limit: none
      [ 526.668768] ---[ end Kernel panic - not syncing: Fatal exception in interrupt
      
      Prevent mod_timer from arming a timer that was already removed by
      del_timer during module unload.
      Signed-off-by: NJan Glauber <jglauber@cavium.com>
      Cc: <stable@vger.kernel.org> # 3.19
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e071518
  10. 02 9月, 2018 1 次提交
  11. 01 9月, 2018 1 次提交
  12. 31 8月, 2018 4 次提交
    • C
      ipmi: Fix I2C client removal in the SSIF driver · 0745dde6
      Corey Minyard 提交于
      The SSIF driver was removing any client that came in through the
      platform interface, but it should only remove clients that it
      added.  On a failure in the probe function, this could result
      in the following oops when the driver is removed and the
      client gets unregistered twice:
      
       CPU: 107 PID: 30266 Comm: rmmod Not tainted 4.18.0+ #80
       Hardware name: Cavium Inc. Saber/Saber, BIOS Cavium reference firmware version 7.0 08/04/2018
       pstate: 60400009 (nZCv daif +PAN -UAO)
       pc : kernfs_find_ns+0x28/0x120
       lr : kernfs_find_and_get_ns+0x40/0x60
       sp : ffff00002310fb50
       x29: ffff00002310fb50 x28: ffff800a8240f800
       x27: 0000000000000000 x26: 0000000000000000
       x25: 0000000056000000 x24: ffff000009073000
       x23: ffff000008998b38 x22: 0000000000000000
       x21: ffff800ed86de820 x20: 0000000000000000
       x19: ffff00000913a1d8 x18: 0000000000000000
       x17: 0000000000000000 x16: 0000000000000000
       x15: 0000000000000000 x14: 5300737265766972
       x13: 643d4d4554535953 x12: 0000000000000030
       x11: 0000000000000030 x10: 0101010101010101
       x9 : ffff800ea06cc3f9 x8 : 0000000000000000
       x7 : 0000000000000141 x6 : ffff000009073000
       x5 : ffff800adb706b00 x4 : 0000000000000000
       x3 : 00000000ffffffff x2 : 0000000000000000
       x1 : ffff000008998b38 x0 : ffff000008356760
       Process rmmod (pid: 30266, stack limit = 0x00000000e218418d)
       Call trace:
        kernfs_find_ns+0x28/0x120
        kernfs_find_and_get_ns+0x40/0x60
        sysfs_unmerge_group+0x2c/0x6c
        dpm_sysfs_remove+0x34/0x70
        device_del+0x58/0x30c
        device_unregister+0x30/0x7c
        i2c_unregister_device+0x84/0x90 [i2c_core]
        ssif_platform_remove+0x38/0x98 [ipmi_ssif]
        platform_drv_remove+0x2c/0x6c
        device_release_driver_internal+0x168/0x1f8
        driver_detach+0x50/0xbc
        bus_remove_driver+0x74/0xe8
        driver_unregister+0x34/0x5c
        platform_driver_unregister+0x20/0x2c
        cleanup_ipmi_ssif+0x50/0xd82c [ipmi_ssif]
        __arm64_sys_delete_module+0x1b4/0x220
        el0_svc_handler+0x104/0x160
        el0_svc+0x8/0xc
       Code: aa1e03e0 aa0203f6 aa0103f7 d503201f (7940e280)
       ---[ end trace 09f0e34cce8e2d8c ]---
       Kernel panic - not syncing: Fatal exception
       SMP: stopping secondary CPUs
       Kernel Offset: disabled
       CPU features: 0x23800c38
      
      So track the clients that the SSIF driver adds and only remove
      those.
      Reported-by: NGeorge Cherian <george.cherian@cavium.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Tested-by: NGeorge Cherian <george.cherian@cavium.com>
      Cc: <stable@vger.kernel.org> # 4.14.x
      0745dde6
    • C
      ipmi: Move BT capabilities detection to the detect call · c86ba91b
      Corey Minyard 提交于
      The capabilities detection was being done as part of the normal
      state machine, but it was possible for it to be running while
      the upper layers of the IPMI driver were initializing the
      device, resulting in error and failure to initialize.
      
      Move the capabilities detection to the the detect function,
      so it's done before anything else runs on the device.  This also
      simplifies the state machine and removes some code, as a bonus.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reported-by: NAndrew Banman <abanman@hpe.com>
      Tested-by: NAndrew Banman <abanman@hpe.com>
      Cc: <stable@vger.kernel.org>
      c86ba91b
    • C
      ipmi: Rework SMI registration failure · 2512e40e
      Corey Minyard 提交于
      There were certain situations where ipmi_register_smi() would
      return a failure, but the interface would still be registered
      and would need to be unregistered.  This is obviously a bad
      design and resulted in an oops in certain failure cases.
      
      If the interface is started up in ipmi_register_smi(), then
      an error occurs, shut down the interface there so the
      cleanup can be done properly.
      
      Fix the various smi users, too.
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      Reported-by: NJustin Ernst <justin.ernst@hpe.com>
      Tested-by: NJustin Ernst <justin.ernst@hpe.com>
      Cc: Andrew Banman <abanman@hpe.com>
      Cc: Russ Anderson <russ.anderson@hpe.com>
      Cc: <stable@vger.kernel.org> # 4.18.x
      2512e40e
    • B
      ipmi: kcs_bmc: don't change device name · cd2315d4
      Benjamin Fair 提交于
      kcs_bmc_alloc(...) calls dev_set_name(...) which is incorrect as most
      bus driver frameworks, platform_driver in particular, assume that they
      are able to set the device name themselves.
      Signed-off-by: NBenjamin Fair <benjaminfair@google.com>
      Signed-off-by: NCorey Minyard <cminyard@mvista.com>
      cd2315d4
  13. 03 8月, 2018 1 次提交
    • J
      random: Make crng state queryable · 9a47249d
      Jason A. Donenfeld 提交于
      It is very useful to be able to know whether or not get_random_bytes_wait
      / wait_for_random_bytes is going to block or not, or whether plain
      get_random_bytes is going to return good randomness or bad randomness.
      
      The particular use case is for mitigating certain attacks in WireGuard.
      A handshake packet arrives and is queued up. Elsewhere a worker thread
      takes items from the queue and processes them. In replying to these
      items, it needs to use some random data, and it has to be good random
      data. If we simply block until we can have good randomness, then it's
      possible for an attacker to fill the queue up with packets waiting to be
      processed. Upon realizing the queue is full, WireGuard will detect that
      it's under a denial of service attack, and behave accordingly. A better
      approach is just to drop incoming handshake packets if the crng is not
      yet initialized.
      
      This patch, therefore, makes that information directly accessible.
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      9a47249d
  14. 02 8月, 2018 1 次提交
  15. 28 7月, 2018 12 次提交