18 Apr, 2019

6 commits


24 Mar, 2019

3 commits

  • commit edeb304f659792fb5bab90d7d6f3408b4c7301fb upstream.

    Within cxl module, iteration over array 'adapter->afu' may be racy
    at few points as it might be simultaneously read during an EEH and its
    contents being set to NULL while driver is being unloaded or unbound
    from the adapter. This might result in a NULL pointer to 'struct afu'
    being de-referenced during an EEH thereby causing a kernel oops.

    This patch fixes this by making sure that all access to the array
    'adapter->afu' is wrapped within the context of spin-lock
    'adapter->afu_list_lock'.

    Fixes: 9e8df8a21963 ("cxl: EEH support")
    Cc: stable@vger.kernel.org # v4.3+
    Acked-by: Andrew Donnellan
    Acked-by: Frederic Barrat
    Acked-by: Christophe Lombard
    Signed-off-by: Vaibhav Jain
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Vaibhav Jain
     
  • commit b5958faa34e2f99f3475ad89c52d98dfea079d33 upstream.

    Fix unbalanced module reference counting during internal reset, which
    prevents the drivers unloading.
    Tracking mei_me/txe modules on mei client bus via
    mei_cldev_enable/disable is error prone due to possible internal
    reset flow, where clients are disconnected underneath.
    Moving reference counting to probe and release of mei bus client
    driver solves this issue in simplest way, as each client provides only
    a single connection to a client bus driver.

    Cc:
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     
  • commit 37fd0b623023484ef6df79ed46f21f06ecc611ff upstream.

    The list of supported functions can be altered upon link reset,
    clean the flags to allow correct selections of supported
    features.

    Cc: v4.19+
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

20 Feb, 2019

1 commit


15 Feb, 2019

3 commits

  • commit 70ed7148dadb812f2f7c9927e98ef3cf4869dfa9 upstream.

    KASAN detects a use-after-free when vop devices are removed.

    This problem was introduced by commit 0063e8bbd2b62d136 ("virtio_vop:
    don't kfree device on register failure"). That patch moved the freeing
    of the struct _vop_vdev to the release function, but failed to ensure
    that vop holds a reference to the device when it doesn't want it to go
    away. A kfree() was replaced with a put_device() in the unregistration
    path, but the last reference to the device is already dropped in
    unregister_virtio_device() so the struct is freed before vop is done
    with it.

    Fix it by holding a reference until cleanup is done. This is similar to
    the fix in virtio_pci in commit 2989be09a8a9d6 ("virtio_pci: fix use
    after free on release").

    ==================================================================
    BUG: KASAN: use-after-free in vop_scan_devices+0xc6c/0xe50 [vop]
    Read of size 8 at addr ffff88800da18580 by task kworker/0:1/12

    CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.0.0-rc4+ #53
    Workqueue: events vop_hotplug_devices [vop]
    Call Trace:
    dump_stack+0x74/0xbb
    print_address_description+0x5d/0x2b0
    ? vop_scan_devices+0xc6c/0xe50 [vop]
    kasan_report+0x152/0x1aa
    ? vop_scan_devices+0xc6c/0xe50 [vop]
    ? vop_scan_devices+0xc6c/0xe50 [vop]
    vop_scan_devices+0xc6c/0xe50 [vop]
    ? vop_loopback_free_irq+0x160/0x160 [vop_loopback]
    process_one_work+0x7c0/0x14b0
    ? pwq_dec_nr_in_flight+0x2d0/0x2d0
    ? do_raw_spin_lock+0x120/0x280
    worker_thread+0x8f/0xbf0
    ? __kthread_parkme+0x78/0xf0
    ? process_one_work+0x14b0/0x14b0
    kthread+0x2ae/0x3a0
    ? kthread_park+0x120/0x120
    ret_from_fork+0x3a/0x50

    Allocated by task 12:
    kmem_cache_alloc_trace+0x13a/0x2a0
    vop_scan_devices+0x473/0xe50 [vop]
    process_one_work+0x7c0/0x14b0
    worker_thread+0x8f/0xbf0
    kthread+0x2ae/0x3a0
    ret_from_fork+0x3a/0x50

    Freed by task 12:
    kfree+0x104/0x310
    device_release+0x73/0x1d0
    kobject_put+0x14f/0x420
    unregister_virtio_device+0x32/0x50
    vop_scan_devices+0x19d/0xe50 [vop]
    process_one_work+0x7c0/0x14b0
    worker_thread+0x8f/0xbf0
    kthread+0x2ae/0x3a0
    ret_from_fork+0x3a/0x50

    The buggy address belongs to the object at ffff88800da18008
    which belongs to the cache kmalloc-2k of size 2048
    The buggy address is located 1400 bytes inside of
    2048-byte region [ffff88800da18008, ffff88800da18808)
    The buggy address belongs to the page:
    page:ffffea0000368600 count:1 mapcount:0 mapping:ffff88801440dbc0 index:0x0 compound_mapcount: 0
    flags: 0x4000000000010200(slab|head)
    raw: 4000000000010200 ffffea0000378608 ffffea000037a008 ffff88801440dbc0
    raw: 0000000000000000 00000000000d000d 00000001ffffffff 0000000000000000
    page dumped because: kasan: bad access detected

    Memory state around the buggy address:
    ffff88800da18480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88800da18500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    >ffff88800da18580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ^
    ffff88800da18600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ffff88800da18680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    ==================================================================

    Fixes: 0063e8bbd2b62d136 ("virtio_vop: don't kfree device on register failure")
    Signed-off-by: Vincent Whitchurch
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Vincent Whitchurch
     
  • commit efe814e90b98aed6d655b5a4092b9114b8b26e42 upstream.

    Add icelake mei device id.

    Cc:
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • commit f8a70d8b889f180e6860cb1f85fed43d37844c5a upstream.

    The > comparison should be >= to prevent reading beyond the end of the
    func->template[] array.

    (The func->template array is allocated in vexpress_syscfg_regmap_init()
    and it has func->num_templates elements.)

    Fixes: 974cc7b93441 ("mfd: vexpress: Define the device as MFD cells")
    Signed-off-by: Dan Carpenter
    Acked-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

31 Jan, 2019

3 commits

  • commit e25df7812c91f62581301f9a7ac102acf92e4937 upstream.

    There is a potential NULL pointer dereference in case kzalloc()
    fails and returns NULL.

    Fix this by adding a NULL check on *session*

    Also, update the function header with information about the
    expected return on failure and remove unnecessary variable rc.

    This issue was detected with the help of Coccinelle.

    Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
    Cc: stable@vger.kernel.org
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     
  • commit f7ee8ead151f9d0b8dac6ab6c3ff49bbe809c564 upstream.

    Add the Denverton innovation engine (IE) device ids.
    The IE is an ME-like device which provides HW security
    offloading.

    Cc:
    Signed-off-by: Tomas Winkler
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • commit 173436ba800d01178a8b19e5de4a8cb02c0db760 upstream.

    The LBG server platform sports DMA support.

    Cc: #v5.0+
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

13 Jan, 2019

1 commit

  • commit fdd669684655c07dacbdb0d753fd13833de69a33 upstream.

    Calling the test program genwqe_cksum with the default buffer size of
    2MB triggers the following kernel warning on s390:

    WARNING: CPU: 30 PID: 9311 at mm/page_alloc.c:3189 __alloc_pages_nodemask+0x45c/0xbe0
    CPU: 30 PID: 9311 Comm: genwqe_cksum Kdump: loaded Not tainted 3.10.0-957.el7.s390x #1
    task: 00000005e5d13980 ti: 00000005e7c6c000 task.ti: 00000005e7c6c000
    Krnl PSW : 0704c00180000000 00000000002780ac (__alloc_pages_nodemask+0x45c/0xbe0)
    R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
    Krnl GPRS: 00000000002932b8 0000000000b73d7c 0000000000000010 0000000000000009
    0000000000000041 00000005e7c6f9b8 0000000000000001 00000000000080d0
    0000000000000000 0000000000b70500 0000000000000001 0000000000000000
    0000000000b70528 00000000007682c0 0000000000277df2 00000005e7c6f9a0
    Krnl Code: 000000000027809e: de7195001000 ed 1280(114,%r9),0(%r1)
    00000000002780a4: a774fead brc 7,277dfe
    #00000000002780a8: a7f40001 brc 15,2780aa
    >00000000002780ac: 92011000 mvi 0(%r1),1
    00000000002780b0: a7f4fea7 brc 15,277dfe
    00000000002780b4: 9101c6b6 tm 1718(%r12),1
    00000000002780b8: a784ff3a brc 8,277f2c
    00000000002780bc: a7f4fe2e brc 15,277d18
    Call Trace:
    ([] __alloc_pages_nodemask+0x1a2/0xbe0)
    [] s390_dma_alloc+0xfe/0x310
    [] __genwqe_alloc_consistent+0xfa/0x148 [genwqe_card]
    [] genwqe_mmap+0xca/0x248 [genwqe_card]
    [] mmap_region+0x4e2/0x778
    [] do_mmap+0x2ac/0x3e0
    [] vm_mmap_pgoff+0xd6/0x118
    [] SyS_mmap_pgoff+0xdc/0x268
    [] SyS_old_mmap+0x8c/0xb0
    [] sysc_tracego+0x14/0x1e
    [] 0x3ffacf87dc6

    turns out the check in __genwqe_alloc_consistent uses "> MAX_ORDER"
    while the mm code uses ">= MAX_ORDER". Fix genwqe.

    Cc: stable@vger.kernel.org
    Signed-off-by: Christian Borntraeger
    Signed-off-by: Frank Haverkamp
    Signed-off-by: Greg Kroah-Hartman

    Christian Borntraeger
     

10 Jan, 2019

2 commits

  • commit 2f07229f02d4c55affccd11a61af4fd4b94dc436 upstream.

    The AFU Descriptor Template in the PCI config space has a Name Space
    field which is a 24 Byte ASCII character string of descriptive name
    space for the AFU. The OCXL driver read the string four characters at
    a time with pci_read_config_dword().

    This optimization is valid on a little-endian system since this is PCI,
    but a big-endian system ends up with each subset of four characters in
    reverse order.

    This could be fixed by switching to read characters one by one. Another
    option is to swap the bytes if we're big-endian.

    Go for the latter with le32_to_cpu().

    Cc: stable@vger.kernel.org # v4.16
    Signed-off-by: Greg Kurz
    Acked-by: Frederic Barrat
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Greg Kurz
     
  • commit e1e71e201703500f708bdeaf64660a2a178cb6a0 upstream.

    All fields in the PE are big-endian. Use cpu_to_be32() like everywhere
    else something is written to the PE. Otherwise a wrong TID will be used
    by the NPU. If this TID happens to point to an existing thread sharing
    the same mm, it could be woken up by error. This is highly improbable
    though. The likely outcome of this is the NPU not finding the target
    thread and forcing the AFU into sending an interrupt, which userspace
    is supposed to handle anyway.

    Fixes: e948e06fc63a ("ocxl: Expose the thread_id needed for wait on POWER9")
    Cc: stable@vger.kernel.org # v4.18
    Signed-off-by: Greg Kurz
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Greg Kurz
     

06 Dec, 2018

1 commit

  • commit 6484a677294aa5d08c0210f2f387ebb9be646115 upstream.

    gcc '-Wunused-but-set-variable' warning:

    drivers/misc/mic/scif/scif_rma.c: In function 'scif_create_remote_lookup':
    drivers/misc/mic/scif/scif_rma.c:373:25: warning:
    variable 'vmalloc_num_pages' set but not used [-Wunused-but-set-variable]

    'vmalloc_num_pages' should be used to determine if the address is
    within the vmalloc range.

    Fixes: ba612aa8b487 ("misc: mic: SCIF memory registration and unregistration")
    Signed-off-by: YueHaibing
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     

27 Nov, 2018

2 commits

  • commit fee05f455ceb5c670cbe48e2f9454ebc4a388554 upstream.

    req.gid can be indirectly controlled by user-space, hence leading to
    a potential exploitation of the Spectre variant 1 vulnerability.

    This issue was detected with the help of Smatch:

    vers/misc/sgi-gru/grukdump.c:200 gru_dump_chiplet_request() warn:
    potential spectre issue 'gru_base' [w]

    Fix this by sanitizing req.gid before calling macro GID_TO_GRU, which
    uses it to index gru_base.

    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://marc.info/?l=linux-kernel&m=152449131114778&w=2

    Cc: stable@vger.kernel.org
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     
  • commit 7c97301285b62a41d6bceded7d964085fc8cc50f upstream.

    After building the kernel with Clang, the following section mismatch
    warning appears:

    WARNING: vmlinux.o(.text+0x3bf19a6): Section mismatch in reference from
    the function ssc_probe() to the function
    .init.text:atmel_ssc_get_driver_data()
    The function ssc_probe() references
    the function __init atmel_ssc_get_driver_data().
    This is often because ssc_probe lacks a __init
    annotation or the annotation of atmel_ssc_get_driver_data is wrong.

    Remove __init from atmel_ssc_get_driver_data to get rid of the mismatch.

    Signed-off-by: Nathan Chancellor
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Nathan Chancellor
     

14 Nov, 2018

3 commits

  • commit 6f8e45f7eb1bee5efdbe4a9cfe4a45627403c5fb upstream.

    The AFU Information DVSEC capability is a means to extract common,
    general information about all of the AFUs associated with a Function
    independent of the specific functionality that each AFU provides.
    Write in the AFU Index field allows to access to the descriptor data
    for each AFU.

    With the current code, we are not able to access to these specific data
    when the index >= 1 because we are writing to the wrong location.
    All requests to the data of each AFU are pointing to those of the AFU 0,
    which could have impacts when using a card with more than one AFU per
    function.

    This patch fixes the access to the AFU Descriptor Data indexed by the
    AFU Info Index field.

    Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices")
    Cc: stable # 4.16
    Signed-off-by: Christophe Lombard
    Signed-off-by: Greg Kroah-Hartman

    Acked-by: Frederic Barrat
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    Christophe Lombard
     
  • commit 0ab93e9c99f8208c0a1a7b7170c827936268c996 upstream.

    The genweq_add_file and genwqe_del_file by caching current without
    using reference counting embed the assumption that a file descriptor
    will never be passed from one process to another. It even embeds the
    assumption that the the thread that opened the file will be in
    existence when the process terminates. Neither of which are
    guaranteed to be true.

    Therefore replace caching the task_struct of the opener with
    pid of the openers thread group id. All the knowledge of the
    opener is used for is as the target of SIGKILL and a SIGKILL
    will kill the entire process group.

    Rename genwqe_force_sig to genwqe_terminate, remove it's unncessary
    signal argument, update it's ownly caller, and use kill_pid
    instead of force_sig.

    The work force_sig does in changing signal handling state is not
    relevant to SIGKILL sent as SEND_SIG_PRIV. The exact same processess
    will be killed just with less work, and less confusion. The work done
    by force_sig is really only needed for handling syncrhonous
    exceptions.

    It will still be possible to cause genwqe_device_remove to wait
    8 seconds by passing a file descriptor to another process but
    the possible user after free is fixed.

    Fixes: eaf4722d4645 ("GenWQE Character device and DDCB queue")
    Cc: stable@vger.kernel.org
    Cc: Greg Kroah-Hartman
    Cc: Frank Haverkamp
    Cc: Joerg-Stephan Vogt
    Cc: Michael Jung
    Cc: Michael Ruettger
    Cc: Kleber Sacilotto de Souza
    Cc: Sebastian Ott
    Cc: Eberhard S. Amann
    Cc: Gabriel Krisman Bertazi
    Cc: Guilherme G. Piccoli
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • [ Upstream commit 11924ba5e671d6caef1516923e2bd8c72929a3fe ]

    When adding a VMCI resource, the check for an existing entry
    would ignore that the new entry could be a wildcard. This could
    result in multiple resource entries that would match a given
    handle. One disastrous outcome of this is that the
    refcounting used to ensure that delayed callbacks for VMCI
    datagrams have run before the datagram is destroyed can be
    wrong, since the refcount could be increased on the duplicate
    entry. This in turn leads to a use after free bug. This issue
    was discovered by Hangbin Liu using KASAN and syzkaller.

    Fixes: bc63dedb7d46 ("VMCI: resource object implementation")
    Reported-by: Hangbin Liu
    Reviewed-by: Adit Ranadive
    Reviewed-by: Vishnu Dasa
    Signed-off-by: Jorgen Hansen
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jorgen Hansen
     

12 Sep, 2018

6 commits

  • val is indirectly controlled by user-space, hence leading to a
    potential exploitation of the Spectre variant 1 vulnerability.

    This issue was detected with the help of Smatch:

    drivers/misc/hmc6352.c:54 compass_store() warn: potential spectre issue
    'map' [r]

    Fix this by sanitizing val before using it to index map

    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://marc.info/?l=linux-kernel&m=152449131114778&w=2

    Cc: stable@vger.kernel.org
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     
  • Currently the assignment is flipped and rc is always 0.

    Signed-off-by: Bryant G. Ly
    Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
    Reviewed-by: Bradley Warrum
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Bryant G. Ly
     
  • In case a client fails to connect in mei_cldev_enable(), the
    caller won't call the mei_cldev_disable leaving the client
    in a linked stated. Upon driver unload the client structure
    will be freed in mei_cl_bus_dev_release(), leaving a stale pointer
    on a fail_list. This will eventually end up in crash
    during power down flow in mei_cl_set_disonnected().

    RIP: mei_cl_set_disconnected+0x5/0x260[mei]
    Call trace:
    mei_cl_all_disconnect+0x22/0x30
    mei_reset+0x194/0x250
    __synchronize_hardirq+0x43/0x50
    _cond_resched+0x15/0x30
    mei_me_intr_clear+0x20/0x100
    mei_stop+0x76/0xb0
    mei_me_shutdown+0x3f/0x80
    pci_device_shutdown+0x34/0x60
    kernel_restart+0x0e/0x30

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200455
    Fixes: 'c110cdb17148 ("mei: bus: make a client pointer always available")'
    Cc: 4.10+
    Tested-by: Georg Müller
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • In case the device is not connected it doesn't 'get'
    hw module and hence should not 'put' it on disable.

    Cc: 4.16+
    Fixes:'commit 257355a44b99 ("mei: make module referencing local to the bus.c")'
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200455
    Tested-by: Georg Müller
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Tomas Winkler
     
  • KASAN reports a use-after-free during startup, in mei_cl_write:

    BUG: KASAN: use-after-free in mei_cl_write+0x601/0x870 [mei]
    (drivers/misc/mei/client.c:1770)

    This is caused by commit 98e70866aacb ("mei: add support for variable
    length mei headers."), which changed the return value from len, to
    buf->size. That ends up using a stale buf pointer, because blocking
    call, the cb (callback) is deleted in me_cl_complete() function.

    However, fortunately, len remains unchanged throughout the function
    (and I don't see anything else that would require re-reading buf->size
    either), so the fix is to simply revert the change, and return len, as
    before.

    Fixes: 98e70866aacb ("mei: add support for variable length mei headers.")
    CC: Arnd Bergmann
    CC: Greg Kroah-Hartman
    Signed-off-by: John Hubbard
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    John Hubbard
     
  • Some of the ME clients are available only for BIOS operation and are
    removed during hand off to an OS. However the removal is not instant.
    A client may be visible on the client list when the mei driver requests
    for enumeration, while the subsequent request for properties will be
    answered with client not found error value. The default behavior
    for an error is to perform client reset while this error is harmless and
    the link reset should be prevented. This issue started to be visible due to
    suspend/resume timing changes. Currently reported only on the Haswell
    based system.

    Fixes:
    [33.564957] mei_me 0000:00:16.0: hbm: properties response: wrong status = 1 CLIENT_NOT_FOUND
    [33.564978] mei_me 0000:00:16.0: mei_irq_read_handler ret = -71.
    [33.565270] mei_me 0000:00:16.0: unexpected reset: dev_state = INIT_CLIENTS fw status = 1E000255 60002306 00000200 00004401 00000000 00000010

    Cc:
    Reported-by: Heiner Kallweit
    Signed-off-by: Alexander Usyskin
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    Alexander Usyskin
     

27 Aug, 2018

1 commit

  • Pull IDA updates from Matthew Wilcox:
    "A better IDA API:

    id = ida_alloc(ida, GFP_xxx);
    ida_free(ida, id);

    rather than the cumbersome ida_simple_get(), ida_simple_remove().

    The new IDA API is similar to ida_simple_get() but better named. The
    internal restructuring of the IDA code removes the bitmap
    preallocation nonsense.

    I hope the net -200 lines of code is convincing"

    * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits)
    ida: Change ida_get_new_above to return the id
    ida: Remove old API
    test_ida: check_ida_destroy and check_ida_alloc
    test_ida: Convert check_ida_conv to new API
    test_ida: Move ida_check_max
    test_ida: Move ida_check_leaf
    idr-test: Convert ida_check_nomem to new API
    ida: Start new test_ida module
    target/iscsi: Allocate session IDs from an IDA
    iscsi target: fix session creation failure handling
    drm/vmwgfx: Convert to new IDA API
    dmaengine: Convert to new IDA API
    ppc: Convert vas ID allocation to new IDA API
    media: Convert entity ID allocation to new IDA API
    ppc: Convert mmu context allocation to new IDA API
    Convert net_namespace to new IDA API
    cb710: Convert to new IDA API
    rsxx: Convert to new IDA API
    osd: Convert to new IDA API
    sd: Convert to new IDA API
    ...

    Linus Torvalds
     

23 Aug, 2018

2 commits

  • Merge more updates from Andrew Morton:

    - the rest of MM

    - procfs updates

    - various misc things

    - more y2038 fixes

    - get_maintainer updates

    - lib/ updates

    - checkpatch updates

    - various epoll updates

    - autofs updates

    - hfsplus

    - some reiserfs work

    - fatfs updates

    - signal.c cleanups

    - ipc/ updates

    * emailed patches from Andrew Morton : (166 commits)
    ipc/util.c: update return value of ipc_getref from int to bool
    ipc/util.c: further variable name cleanups
    ipc: simplify ipc initialization
    ipc: get rid of ids->tables_initialized hack
    lib/rhashtable: guarantee initial hashtable allocation
    lib/rhashtable: simplify bucket_table_alloc()
    ipc: drop ipc_lock()
    ipc/util.c: correct comment in ipc_obtain_object_check
    ipc: rename ipcctl_pre_down_nolock()
    ipc/util.c: use ipc_rcu_putref() for failues in ipc_addid()
    ipc: reorganize initialization of kern_ipc_perm.seq
    ipc: compute kern_ipc_perm.id under the ipc lock
    init/Kconfig: remove EXPERT from CHECKPOINT_RESTORE
    fs/sysv/inode.c: use ktime_get_real_seconds() for superblock stamp
    adfs: use timespec64 for time conversion
    kernel/sysctl.c: fix typos in comments
    drivers/rapidio/devices/rio_mport_cdev.c: remove redundant pointer md
    fork: don't copy inconsistent signal handler state to child
    signal: make get_signal() return bool
    signal: make sigkill_pending() return bool
    ...

    Linus Torvalds
     
  • There are several blockable mmu notifiers which might sleep in
    mmu_notifier_invalidate_range_start and that is a problem for the
    oom_reaper because it needs to guarantee a forward progress so it cannot
    depend on any sleepable locks.

    Currently we simply back off and mark an oom victim with blockable mmu
    notifiers as done after a short sleep. That can result in selecting a new
    oom victim prematurely because the previous one still hasn't torn its
    memory down yet.

    We can do much better though. Even if mmu notifiers use sleepable locks
    there is no reason to automatically assume those locks are held. Moreover
    majority of notifiers only care about a portion of the address space and
    there is absolutely zero reason to fail when we are unmapping an unrelated
    range. Many notifiers do really block and wait for HW which is harder to
    handle and we have to bail out though.

    This patch handles the low hanging fruit.
    __mmu_notifier_invalidate_range_start gets a blockable flag and callbacks
    are not allowed to sleep if the flag is set to false. This is achieved by
    using trylock instead of the sleepable lock for most callbacks and
    continue as long as we do not block down the call chain.

    I think we can improve that even further because there is a common pattern
    to do a range lookup first and then do something about that. The first
    part can be done without a sleeping lock in most cases AFAICS.

    The oom_reaper end then simply retries if there is at least one notifier
    which couldn't make any progress in !blockable mode. A retry loop is
    already implemented to wait for the mmap_sem and this is basically the
    same thing.

    The simplest way for driver developers to test this code path is to wrap
    userspace code which uses these notifiers into a memcg and set the hard
    limit to hit the oom. This can be done e.g. after the test faults in all
    the mmu notifier managed memory and set the hard limit to something really
    small. Then we are looking for a proper process tear down.

    [akpm@linux-foundation.org: coding style fixes]
    [akpm@linux-foundation.org: minor code simplification]
    Link: http://lkml.kernel.org/r/20180716115058.5559-1-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Acked-by: Christian König # AMD notifiers
    Acked-by: Leon Romanovsky # mlx and umem_odp
    Reported-by: David Rientjes
    Cc: "David (ChunMing) Zhou"
    Cc: Paolo Bonzini
    Cc: Alex Deucher
    Cc: David Airlie
    Cc: Jani Nikula
    Cc: Joonas Lahtinen
    Cc: Rodrigo Vivi
    Cc: Doug Ledford
    Cc: Jason Gunthorpe
    Cc: Mike Marciniszyn
    Cc: Dennis Dalessandro
    Cc: Sudeep Dutt
    Cc: Ashutosh Dixit
    Cc: Dimitri Sivanich
    Cc: Boris Ostrovsky
    Cc: Juergen Gross
    Cc: "Jérôme Glisse"
    Cc: Andrea Arcangeli
    Cc: Felix Kuehling
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

22 Aug, 2018

2 commits

  • Eliminates the custom spinlock and the call to ida_pre_get.

    Signed-off-by: Matthew Wilcox
    Acked-by: Michał Mirosław

    Matthew Wilcox
     
  • Pull i2c updates from Wolfram Sang:

    - the core has now a lockless variant of i2c_smbus_xfer. Some open
    coded versions of this got removed in drivers. This also enables
    proper SCCB support in regmap.

    - locking got a more precise naming. i2c_{un}lock_adapter() had to go,
    and we know use i2c_lock_bus() consistently with flags like
    I2C_LOCK_ROOT_ADAPTER and I2C_LOCK_SEGMENT to avoid ambiguity.

    - the gpio fault injector got a new delicate testcase

    - the bus recovery procedure got fixed to handle the new testcase
    correctly

    - a new quirk flag for controllers not able to handle zero length
    messages together with driver updates to use it

    - new drivers: FSI bus attached I2C masters, GENI I2C controller, Owl
    family S900

    - and a good set of driver improvements and bugfixes

    * 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (77 commits)
    i2c: rcar: implement STOP and REP_START according to docs
    i2c: rcar: refactor private flags
    i2c: core: ACPI: Make acpi_gsb_i2c_read_bytes() check i2c_transfer return value
    i2c: core: ACPI: Properly set status byte to 0 for multi-byte writes
    dt-bindings: i2c: rcar: Add r8a774a1 support
    dt-bindings: i2c: sh_mobile: Add r8a774a1 support
    i2c: imx: Simplify stopped state tracking
    i2c: imx: Fix race condition in dma read
    i2c: pasemi: remove hardcoded bus numbers on smbus
    i2c: designware: Add SPDX license tag
    i2c: designware: Convert to use struct i2c_timings
    i2c: core: Parse SDA hold time from firmware
    i2c: designware-pcidrv: Mark expected switch fall-through
    i2c: amd8111: Mark expected switch fall-through
    i2c: sh_mobile: use core to detect 'no zero length read' quirk
    i2c: xlr: use core to detect 'no zero length' quirk
    i2c: rcar: use core to detect 'no zero length' quirk
    i2c: stu300: use core to detect 'no zero length' quirk
    i2c: pmcmsp: use core to detect 'no zero length' quirk
    i2c: mxs: use core to detect 'no zero length' quirk
    ...

    Linus Torvalds
     

19 Aug, 2018

1 commit

  • Pull char/misc driver updates from Greg KH:
    "Here is the bit set of char/misc drivers for 4.19-rc1

    There is a lot here, much more than normal, seems like everyone is
    writing new driver subsystems these days... Anyway, major things here
    are:

    - new FSI driver subsystem, yet-another-powerpc low-level hardware
    bus

    - gnss, finally an in-kernel GPS subsystem to try to tame all of the
    crazy out-of-tree drivers that have been floating around for years,
    combined with some really hacky userspace implementations. This is
    only for GNSS receivers, but you have to start somewhere, and this
    is great to see.

    Other than that, there are new slimbus drivers, new coresight drivers,
    new fpga drivers, and loads of DT bindings for all of these and
    existing drivers.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'char-misc-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (255 commits)
    android: binder: Rate-limit debug and userspace triggered err msgs
    fsi: sbefifo: Bump max command length
    fsi: scom: Fix NULL dereference
    misc: mic: SCIF Fix scif_get_new_port() error handling
    misc: cxl: changed asterisk position
    genwqe: card_base: Use true and false for boolean values
    misc: eeprom: assignment outside the if statement
    uio: potential double frees if __uio_register_device() fails
    eeprom: idt_89hpesx: clean up an error pointer vs NULL inconsistency
    misc: ti-st: Fix memory leak in the error path of probe()
    android: binder: Show extra_buffers_size in trace
    firmware: vpd: Fix section enabled flag on vpd_section_destroy
    platform: goldfish: Retire pdev_bus
    goldfish: Use dedicated macros instead of manual bit shifting
    goldfish: Add missing includes to goldfish.h
    mux: adgs1408: new driver for Analog Devices ADGS1408/1409 mux
    dt-bindings: mux: add adi,adgs1408
    Drivers: hv: vmbus: Cleanup synic memory free path
    Drivers: hv: vmbus: Remove use of slow_virt_to_phys()
    Drivers: hv: vmbus: Reset the channel callback in vmbus_onoffer_rescind()
    ...

    Linus Torvalds
     

18 Aug, 2018

3 commits

  • Merge updates from Andrew Morton:

    - a few misc things

    - a few Y2038 fixes

    - ntfs fixes

    - arch/sh tweaks

    - ocfs2 updates

    - most of MM

    * emailed patches from Andrew Morton : (111 commits)
    mm/hmm.c: remove unused variables align_start and align_end
    fs/userfaultfd.c: remove redundant pointer uwq
    mm, vmacache: hash addresses based on pmd
    mm/list_lru: introduce list_lru_shrink_walk_irq()
    mm/list_lru.c: pass struct list_lru_node* as an argument to __list_lru_walk_one()
    mm/list_lru.c: move locking from __list_lru_walk_one() to its caller
    mm/list_lru.c: use list_lru_walk_one() in list_lru_walk_node()
    mm, swap: make CONFIG_THP_SWAP depend on CONFIG_SWAP
    mm/sparse: delete old sparse_init and enable new one
    mm/sparse: add new sparse_init_nid() and sparse_init()
    mm/sparse: move buffer init/fini to the common place
    mm/sparse: use the new sparse buffer functions in non-vmemmap
    mm/sparse: abstract sparse buffer allocations
    mm/hugetlb.c: don't zero 1GiB bootmem pages
    mm, page_alloc: double zone's batchsize
    mm/oom_kill.c: document oom_lock
    mm/hugetlb: remove gigantic page support for HIGHMEM
    mm, oom: remove sleep from under oom_lock
    kernel/dma: remove unsupported gfp_mask parameter from dma_alloc_from_contiguous()
    mm/cma: remove unsupported gfp_mask parameter from cma_alloc()
    ...

    Linus Torvalds
     
  • Use new return type vm_fault_t for fault handler. For now, this is just
    documenting that the function returns a VM_FAULT value rather than an
    errno. Once all instances are converted, vm_fault_t will become a
    distinct type.

    Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")

    In this patch all the caller of handle_mm_fault() are changed to return
    vm_fault_t type.

    Link: http://lkml.kernel.org/r/20180617084810.GA6730@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Cc: Matthew Wilcox
    Cc: Richard Henderson
    Cc: Tony Luck
    Cc: Matt Turner
    Cc: Vineet Gupta
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Richard Kuo
    Cc: Geert Uytterhoeven
    Cc: Michal Simek
    Cc: James Hogan
    Cc: Ley Foon Tan
    Cc: Jonas Bonn
    Cc: James E.J. Bottomley
    Cc: Benjamin Herrenschmidt
    Cc: Palmer Dabbelt
    Cc: Yoshinori Sato
    Cc: David S. Miller
    Cc: Richard Weinberger
    Cc: Guan Xuetao
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: "Levin, Alexander (Sasha Levin)"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Souptick Joarder
     
  • Pull powerpc updates from Michael Ellerman:
    "Notable changes:

    - A fix for a bug in our page table fragment allocator, where a page
    table page could be freed and reallocated for something else while
    still in use, leading to memory corruption etc. The fix reuses
    pt_mm in struct page (x86 only) for a powerpc only refcount.

    - Fixes to our pkey support. Several are user-visible changes, but
    bring us in to line with x86 behaviour and/or fix outright bugs.
    Thanks to Florian Weimer for reporting many of these.

    - A series to improve the hvc driver & related OPAL console code,
    which have been seen to cause hardlockups at times. The hvc driver
    changes in particular have been in linux-next for ~month.

    - Increase our MAX_PHYSMEM_BITS to 128TB when SPARSEMEM_VMEMMAP=y.

    - Remove Power8 DD1 and Power9 DD1 support, neither chip should be in
    use anywhere other than as a paper weight.

    - An optimised memcmp implementation using Power7-or-later VMX
    instructions

    - Support for barrier_nospec on some NXP CPUs.

    - Support for flushing the count cache on context switch on some IBM
    CPUs (controlled by firmware), as a Spectre v2 mitigation.

    - A series to enhance the information we print on unhandled signals
    to bring it into line with other arches, including showing the
    offending VMA and dumping the instructions around the fault.

    Thanks to: Aaro Koskinen, Akshay Adiga, Alastair D'Silva, Alexey
    Kardashevskiy, Alexey Spirkov, Alistair Popple, Andrew Donnellan,
    Aneesh Kumar K.V, Anju T Sudhakar, Arnd Bergmann, Bartosz Golaszewski,
    Benjamin Herrenschmidt, Bharat Bhushan, Bjoern Noetel, Boqun Feng,
    Breno Leitao, Bryant G. Ly, Camelia Groza, Christophe Leroy, Christoph
    Hellwig, Cyril Bur, Dan Carpenter, Daniel Klamt, Darren Stevens, Dave
    Young, David Gibson, Diana Craciun, Finn Thain, Florian Weimer,
    Frederic Barrat, Gautham R. Shenoy, Geert Uytterhoeven, Geoff Levand,
    Guenter Roeck, Gustavo Romero, Haren Myneni, Hari Bathini, Joel
    Stanley, Jonathan Neuschäfer, Kees Cook, Madhavan Srinivasan, Mahesh
    Salgaonkar, Markus Elfring, Mathieu Malaterre, Mauro S. M. Rodrigues,
    Michael Hanselmann, Michael Neuling, Michael Schmitz, Mukesh Ojha,
    Murilo Opsfelder Araujo, Nicholas Piggin, Parth Y Shah, Paul
    Mackerras, Paul Menzel, Ram Pai, Randy Dunlap, Rashmica Gupta, Reza
    Arbab, Rodrigo R. Galvao, Russell Currey, Sam Bobroff, Scott Wood,
    Shilpasri G Bhat, Simon Guo, Souptick Joarder, Stan Johnson, Thiago
    Jung Bauermann, Tyrel Datwyler, Vaibhav Jain, Vasant Hegde, Venkat
    Rao, zhong jiang"

    * tag 'powerpc-4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (234 commits)
    powerpc/mm/book3s/radix: Add mapping statistics
    powerpc/uaccess: Enable get_user(u64, *p) on 32-bit
    powerpc/mm/hash: Remove unnecessary do { } while(0) loop
    powerpc/64s: move machine check SLB flushing to mm/slb.c
    powerpc/powernv/idle: Fix build error
    powerpc/mm/tlbflush: update the mmu_gather page size while iterating address range
    powerpc/mm: remove warning about ‘type’ being set
    powerpc/32: Include setup.h header file to fix warnings
    powerpc: Move `path` variable inside DEBUG_PROM
    powerpc/powermac: Make some functions static
    powerpc/powermac: Remove variable x that's never read
    cxl: remove a dead branch
    powerpc/powermac: Add missing include of header pmac.h
    powerpc/kexec: Use common error handling code in setup_new_fdt()
    powerpc/xmon: Add address lookup for percpu symbols
    powerpc/mm: remove huge_pte_offset_and_shift() prototype
    powerpc/lib: Use patch_site to patch copy_32 functions once cache is enabled
    powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
    powerpc/fadump: merge adjacent memory ranges to reduce PT_LOAD segements
    powerpc/fadump: handle crash memory ranges array index overflow
    ...

    Linus Torvalds