04 Feb, 2020

1 commit

  • 'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p).
    Hence, IS_ERR(p) is unneeded.

    The semantic patch that generates this commit is as follows:

    //
    @@
    expression ptr;
    constant error_code;
    @@
    -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code)
    +PTR_ERR(ptr) == - error_code
    //

    Link: http://lkml.kernel.org/r/20200106045833.1725-1-masahiroy@kernel.org
    Signed-off-by: Masahiro Yamada
    Cc: Julia Lawall
    Acked-by: Stephen Boyd [drivers/clk/clk.c]
    Acked-by: Bartosz Golaszewski [GPIO]
    Acked-by: Wolfram Sang [drivers/i2c]
    Acked-by: Rafael J. Wysocki [acpi/scan.c]
    Acked-by: Rob Herring
    Cc: Eric Biggers
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

03 Feb, 2020

1 commit

  • Pull char/misc fix from Greg KH:
    "Here is a single patch, that fixes up a commit that came in the
    previous char/misc merge.

    It fixes a bug in the hpet driver that everyone keeps tripping over in
    their automated testing. Good thing is, people are catching it. Bad
    thing it wasn't caught by anyone testing before this. Oh well...

    This has been in linux-next for a few days with no reported issues"

    * tag 'char-misc-5.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
    char: hpet: Fix out-of-bounds read bug

    Linus Torvalds
     

02 Feb, 2020

1 commit

  • Pull random changes from Ted Ts'o:
    "Change /dev/random so that it uses the CRNG and only blocking if the
    CRNG hasn't initialized, instead of the old blocking pool. Also clean
    up archrandom.h, and some other miscellaneous cleanups"

    * tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random: (24 commits)
    s390x: Mark archrandom.h functions __must_check
    powerpc: Mark archrandom.h functions __must_check
    powerpc: Use bool in archrandom.h
    x86: Mark archrandom.h functions __must_check
    linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check
    linux/random.h: Use false with bool
    linux/random.h: Remove arch_has_random, arch_has_random_seed
    s390: Remove arch_has_random, arch_has_random_seed
    powerpc: Remove arch_has_random, arch_has_random_seed
    x86: Remove arch_has_random, arch_has_random_seed
    random: remove some dead code of poolinfo
    random: fix typo in add_timer_randomness()
    random: Add and use pr_fmt()
    random: convert to ENTROPY_BITS for better code readability
    random: remove unnecessary unlikely()
    random: remove kernel.random.read_wakeup_threshold
    random: delete code to pull data into pools
    random: remove the blocking pool
    random: make /dev/random be almost like /dev/urandom
    random: ignore GRND_RANDOM in getentropy(2)
    ...

    Linus Torvalds
     

30 Jan, 2020

3 commits

  • Currently, there is an out-of-bounds read on array hpetp->hp_dev
    in the following for loop:

    870 for (i = 0; i < hdp->hd_nirqs; i++)
    871 hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];

    This is due to the recent change from one-element array to
    flexible-array member in struct hpets:

    104 struct hpets {
    ...
    113 struct hpet_dev hp_dev[];
    114 };

    This change affected the total size of the dynamic memory
    allocation, decreasing it by one time the size of struct hpet_dev.

    Fix this by adjusting the allocation size when calling
    struct_size().

    Fixes: 987f028b8637c ("char: hpet: Use flexible-array member")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Tetsuo Handa
    Acked-by: Eric Biggers
    Link: https://lore.kernel.org/r/20200129022613.GA24281@embeddedor.com
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     
  • Pull char/misc driver updates from Greg KH:
    "Here is the big char/misc/whatever driver changes for 5.6-rc1

    Included in here are loads of things from a variety of different
    driver subsystems:
    - soundwire updates
    - binder updates
    - nvmem updates
    - firmware drivers updates
    - extcon driver updates
    - various misc driver updates
    - fpga driver updates
    - interconnect subsystem and driver updates
    - bus driver updates
    - uio driver updates
    - mei driver updates
    - w1 driver cleanups
    - various other small driver updates

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

    * tag 'char-misc-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (86 commits)
    mei: me: add jasper point DID
    char: hpet: Use flexible-array member
    binder: fix log spam for existing debugfs file creation.
    mei: me: add comet point (lake) H device ids
    nvmem: add QTI SDAM driver
    dt-bindings: nvmem: add binding for QTI SPMI SDAM
    dt-bindings: imx-ocotp: Add i.MX8MP compatible
    dt-bindings: soundwire: fix example
    soundwire: cadence: fix kernel-doc parameter descriptions
    soundwire: intel: report slave_ids for each link to SOF driver
    siox: Use the correct style for SPDX License Identifier
    w1: omap-hdq: Simplify driver with PM runtime autosuspend
    firmware: stratix10-svc: Remove unneeded semicolon
    firmware: google: Probe for a GSMI handler in firmware
    firmware: google: Unregister driver_info on failure and exit in gsmi
    firmware: google: Release devices before unregistering the bus
    slimbus: qcom: add missed clk_disable_unprepare in remove
    slimbus: Use the correct style for SPDX License Identifier
    slimbus: qcom-ngd-ctrl: Use dma_request_chan() instead dma_request_slave_channel()
    dt-bindings: SLIMBus: add slim devices optional properties
    ...

    Linus Torvalds
     
  • Pull tty/serial driver updates from Greg KH:
    "Here are the big set of tty and serial driver updates for 5.6-rc1

    Included in here are:
    - dummy_con cleanups (touches lots of arch code)
    - sysrq logic cleanups (touches lots of serial drivers)
    - samsung driver fixes (wasn't really being built)
    - conmakeshash move to tty subdir out of scripts
    - lots of small tty/serial driver updates

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

    * tag 'tty-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (140 commits)
    tty: n_hdlc: Use flexible-array member and struct_size() helper
    tty: baudrate: SPARC supports few more baud rates
    tty: baudrate: Synchronise baud_table[] and baud_bits[]
    tty: serial: meson_uart: Add support for kernel debugger
    serial: imx: fix a race condition in receive path
    serial: 8250_bcm2835aux: Document struct bcm2835aux_data
    serial: 8250_bcm2835aux: Use generic remapping code
    serial: 8250_bcm2835aux: Allocate uart_8250_port on stack
    serial: 8250_bcm2835aux: Suppress register_port error on -EPROBE_DEFER
    serial: 8250_bcm2835aux: Suppress clk_get error on -EPROBE_DEFER
    serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
    serial_core: Remove unused member in uart_port
    vt: Correct comment documenting do_take_over_console()
    vt: Delete comment referencing non-existent unbind_con_driver()
    arch/xtensa/setup: Drop dummy_con initialization
    arch/x86/setup: Drop dummy_con initialization
    arch/unicore32/setup: Drop dummy_con initialization
    arch/sparc/setup: Drop dummy_con initialization
    arch/sh/setup: Drop dummy_con initialization
    arch/s390/setup: Drop dummy_con initialization
    ...

    Linus Torvalds
     

29 Jan, 2020

2 commits

  • Pull networking updates from David Miller:

    1) Add WireGuard

    2) Add HE and TWT support to ath11k driver, from John Crispin.

    3) Add ESP in TCP encapsulation support, from Sabrina Dubroca.

    4) Add variable window congestion control to TIPC, from Jon Maloy.

    5) Add BCM84881 PHY driver, from Russell King.

    6) Start adding netlink support for ethtool operations, from Michal
    Kubecek.

    7) Add XDP drop and TX action support to ena driver, from Sameeh
    Jubran.

    8) Add new ipv4 route notifications so that mlxsw driver does not have
    to handle identical routes itself. From Ido Schimmel.

    9) Add BPF dynamic program extensions, from Alexei Starovoitov.

    10) Support RX and TX timestamping in igc, from Vinicius Costa Gomes.

    11) Add support for macsec HW offloading, from Antoine Tenart.

    12) Add initial support for MPTCP protocol, from Christoph Paasch,
    Matthieu Baerts, Florian Westphal, Peter Krystad, and many others.

    13) Add Octeontx2 PF support, from Sunil Goutham, Geetha sowjanya, Linu
    Cherian, and others.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1469 commits)
    net: phy: add default ARCH_BCM_IPROC for MDIO_BCM_IPROC
    udp: segment looped gso packets correctly
    netem: change mailing list
    qed: FW 8.42.2.0 debug features
    qed: rt init valid initialization changed
    qed: Debug feature: ilt and mdump
    qed: FW 8.42.2.0 Add fw overlay feature
    qed: FW 8.42.2.0 HSI changes
    qed: FW 8.42.2.0 iscsi/fcoe changes
    qed: Add abstraction for different hsi values per chip
    qed: FW 8.42.2.0 Additional ll2 type
    qed: Use dmae to write to widebus registers in fw_funcs
    qed: FW 8.42.2.0 Parser offsets modified
    qed: FW 8.42.2.0 Queue Manager changes
    qed: FW 8.42.2.0 Expose new registers and change windows
    qed: FW 8.42.2.0 Internal ram offsets modifications
    MAINTAINERS: Add entry for Marvell OcteonTX2 Physical Function driver
    Documentation: net: octeontx2: Add RVU HW and drivers overview
    octeontx2-pf: ethtool RSS config support
    octeontx2-pf: Add basic ethtool support
    ...

    Linus Torvalds
     
  • Pull crypto updates from Herbert Xu:
    "API:
    - Removed CRYPTO_TFM_RES flags
    - Extended spawn grabbing to all algorithm types
    - Moved hash descsize verification into API code

    Algorithms:
    - Fixed recursive pcrypt dead-lock
    - Added new 32 and 64-bit generic versions of poly1305
    - Added cryptogams implementation of x86/poly1305

    Drivers:
    - Added support for i.MX8M Mini in caam
    - Added support for i.MX8M Nano in caam
    - Added support for i.MX8M Plus in caam
    - Added support for A33 variant of SS in sun4i-ss
    - Added TEE support for Raven Ridge in ccp
    - Added in-kernel API to submit TEE commands in ccp
    - Added AMD-TEE driver
    - Added support for BCM2711 in iproc-rng200
    - Added support for AES256-GCM based ciphers for chtls
    - Added aead support on SEC2 in hisilicon"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (244 commits)
    crypto: arm/chacha - fix build failured when kernel mode NEON is disabled
    crypto: caam - add support for i.MX8M Plus
    crypto: x86/poly1305 - emit does base conversion itself
    crypto: hisilicon - fix spelling mistake "disgest" -> "digest"
    crypto: chacha20poly1305 - add back missing test vectors and test chunking
    crypto: x86/poly1305 - fix .gitignore typo
    tee: fix memory allocation failure checks on drv_data and amdtee
    crypto: ccree - erase unneeded inline funcs
    crypto: ccree - make cc_pm_put_suspend() void
    crypto: ccree - split overloaded usage of irq field
    crypto: ccree - fix PM race condition
    crypto: ccree - fix FDE descriptor sequence
    crypto: ccree - cc_do_send_request() is void func
    crypto: ccree - fix pm wrongful error reporting
    crypto: ccree - turn errors to debug msgs
    crypto: ccree - fix AEAD decrypt auth fail
    crypto: ccree - fix typo in comment
    crypto: ccree - fix typos in error msgs
    crypto: atmel-{aes,sha,tdes} - Retire crypto_platform_data
    crypto: x86/sha - Eliminate casts on asm implementations
    ...

    Linus Torvalds
     

28 Jan, 2020

1 commit


24 Jan, 2020

1 commit

  • Old code in the kernel uses 1-byte and 0-byte arrays to indicate the
    presence of a "variable length array":

    struct something {
    int length;
    u8 data[1];
    };

    struct something *instance;

    instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL);
    instance->length = size;
    memcpy(instance->data, source, size);

    There is also 0-byte arrays. Both cases pose confusion for things like
    sizeof(), CONFIG_FORTIFY_SOURCE, etc.[1] Instead, the preferred mechanism
    to declare variable-length types such as the one above is a flexible array
    member[2] which need to be the last member of a structure and empty-sized:

    struct something {
    int stuff;
    u8 data[];
    };

    Also, by making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    unadvertenly introduced[3] to the codebase from now on.

    [1] https://github.com/KSPP/linux/issues/21
    [2] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200120235326.GA29231@embeddedor.com
    Signed-off-by: Greg Kroah-Hartman

    Gustavo A. R. Silva
     

22 Jan, 2020

1 commit

  • Easily determining what TCG version a tpm device implements
    has been a pain point for userspace for a long time, so
    add a sysfs file to report the TCG major version of a tpm device.

    Also add an entry to Documentation/ABI/stable/sysfs-class-tpm
    describing the new file.

    Cc: Jarkko Sakkinen
    Cc: Mimi Zohar
    Cc: Peter Huewe
    Cc: Jason Gunthorpe
    Cc: linux-integrity@vger.kernel.org
    Signed-off-by: Jerry Snitselaar
    Reviewed-by: Mimi Zohar
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    Jerry Snitselaar
     

14 Jan, 2020

1 commit

  • tpk_write()/tpk_close() could be interrupted when holding a mutex, then
    in timer handler tpk_write() may be called again trying to acquire same
    mutex, lead to deadlock.

    Google syzbot reported this issue with CONFIG_DEBUG_ATOMIC_SLEEP
    enabled:

    BUG: sleeping function called from invalid context at
    kernel/locking/mutex.c:938
    in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
    1 lock held by swapper/1/0:
    ...
    Call Trace:

    dump_stack+0x197/0x210
    ___might_sleep.cold+0x1fb/0x23e
    __might_sleep+0x95/0x190
    __mutex_lock+0xc5/0x13c0
    mutex_lock_nested+0x16/0x20
    tpk_write+0x5d/0x340
    resync_tnc+0x1b6/0x320
    call_timer_fn+0x1ac/0x780
    run_timer_softirq+0x6c3/0x1790
    __do_softirq+0x262/0x98c
    irq_exit+0x19b/0x1e0
    smp_apic_timer_interrupt+0x1a3/0x610
    apic_timer_interrupt+0xf/0x20

    See link https://syzkaller.appspot.com/bug?extid=2eeef62ee31f9460ad65 for
    more details.

    Fix it by using spinlock in process context instead of mutex and having
    interrupt disabled in critical section.

    Reported-by: syzbot+2eeef62ee31f9460ad65@syzkaller.appspotmail.com
    Signed-off-by: Zhenzhong Duan
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20200113034842.435-1-zhenzhong.duan@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Zhenzhong Duan
     

10 Jan, 2020

1 commit


09 Jan, 2020

1 commit

  • The priv->response_length can hold the size of an response or an negative
    error code, and the tpm_common_read() needs to handle both cases correctly.
    Changed the type of response_length to signed and accounted for negative
    value in tpm_common_read().

    Cc: stable@vger.kernel.org
    Fixes: d23d12484307 ("tpm: fix invalid locking in NONBLOCKING mode")
    Reported-by: Laura Abbott
    Signed-off-by: Tadeusz Struk
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    Tadeusz Struk
     

08 Jan, 2020

14 commits

  • Since it is not being used, so delete it.

    Signed-off-by: Yangtao Li
    Link: https://lore.kernel.org/r/20190607182517.28266-5-tiny.windzz@gmail.com
    Signed-off-by: Theodore Ts'o

    Yangtao Li
     
  • s/entimate/estimate

    Signed-off-by: Yangtao Li
    Link: https://lore.kernel.org/r/20190607182517.28266-4-tiny.windzz@gmail.com
    Signed-off-by: Theodore Ts'o

    Yangtao Li
     
  • Prefix all printk/pr_ messages with "random: " to make the
    logging a bit more consistent.

    Miscellanea:

    o Convert a printks to pr_notice
    o Whitespace to align to open parentheses
    o Remove embedded "random: " from pr_* as pr_fmt adds it

    Signed-off-by: Yangtao Li
    Link: https://lore.kernel.org/r/20190607182517.28266-3-tiny.windzz@gmail.com
    Signed-off-by: Theodore Ts'o

    Yangtao Li
     
  • Signed-off-by: Yangtao Li
    Link: https://lore.kernel.org/r/20190607182517.28266-2-tiny.windzz@gmail.com
    Signed-off-by: Theodore Ts'o

    Yangtao Li
     
  • WARN_ON() already contains an unlikely(), so it's not necessary to use
    unlikely.

    Signed-off-by: Yangtao Li
    Link: https://lore.kernel.org/r/20190607182517.28266-1-tiny.windzz@gmail.com
    Signed-off-by: Theodore Ts'o

    Yangtao Li
     
  • It has no effect any more, so remove it. We can revert this if
    there is some user code that expects to be able to set this sysctl.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/a74ed2cf0b5a5451428a246a9239f5bc4e29358f.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • There is no pool that pulls, so it was just dead code.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/4a05fe0c7a5c831389ef4aea51d24528ac8682c7.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • There is no longer any interface to read data from the blocking
    pool, so remove it.

    This enables quite a bit of code deletion, much of which will be
    done in subsequent patches.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/511225a224bf0a291149d3c0b8b45393cd03ab96.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • This patch changes the read semantics of /dev/random to be the same
    as /dev/urandom except that reads will block until the CRNG is
    ready.

    None of the cleanups that this enables have been done yet. As a
    result, this gives a warning about an unused function.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/5e6ac8831c6cf2e56a7a4b39616d1732b2bdd06c.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • The separate blocking pool is going away. Start by ignoring
    GRND_RANDOM in getentropy(2).

    This should not materially break any API. Any code that worked
    without this change should work at least as well with this change.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/705c5a091b63cc5da70c99304bb97e0109be0a26.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/d5473b56cf1fa900ca4bd2b3fc1e5b8874399919.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • /dev/random and getrandom() never warn. Split the meat of
    urandom_read() into urandom_read_nowarn() and leave the warning code
    in urandom_read().

    This has no effect on kernel behavior, but it makes subsequent
    patches more straightforward. It also makes the fact that
    getrandom() never warns more obvious.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/c87ab200588de746431d9f916501ef11e5242b13.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • crng_init_wait is only used to wayt for crng_init to be set to 2, so
    there's no point to waking it when crng_init is set to 1. Remove the
    unnecessary wake_up_interruptible() call.

    Signed-off-by: Andy Lutomirski
    Link: https://lore.kernel.org/r/6fbc0bfcbfc1fa2c76fd574f5b6f552b11be7fde.1577088521.git.luto@kernel.org
    Signed-off-by: Theodore Ts'o

    Andy Lutomirski
     
  • Sergey didn't like the locking order,

    uart_port->lock -> tty_port->lock

    uart_write (uart_port->lock)
    __uart_start
    pl011_start_tx
    pl011_tx_chars
    uart_write_wakeup
    tty_port_tty_wakeup
    tty_port_default
    tty_port_tty_get (tty_port->lock)

    but those code is so old, and I have no clue how to de-couple it after
    checking other locks in the splat. There is an onging effort to make all
    printk() as deferred, so until that happens, workaround it for now as a
    short-term fix.

    LTP: starting iogen01 (export LTPROOT; rwtest -N iogen01 -i 120s -s
    read,write -Da -Dv -n 2 500b:$TMPDIR/doio.f1.$$
    1000b:$TMPDIR/doio.f2.$$)
    WARNING: possible circular locking dependency detected
    ------------------------------------------------------
    doio/49441 is trying to acquire lock:
    ffff008b7cff7290 (&(&zone->lock)->rlock){..-.}, at: rmqueue+0x138/0x2050

    but task is already holding lock:
    60ff000822352818 (&pool->lock/1){-.-.}, at: start_flush_work+0xd8/0x3f0

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #4 (&pool->lock/1){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    __queue_work+0x4b4/0xa10
    queue_work_on+0xac/0x11c
    tty_schedule_flip+0x84/0xbc
    tty_flip_buffer_push+0x1c/0x28
    pty_write+0x98/0xd0
    n_tty_write+0x450/0x60c
    tty_write+0x338/0x474
    __vfs_write+0x88/0x214
    vfs_write+0x12c/0x1a4
    redirected_tty_write+0x90/0xdc
    do_loop_readv_writev+0x140/0x180
    do_iter_write+0xe0/0x10c
    vfs_writev+0x134/0x1cc
    do_writev+0xbc/0x130
    __arm64_sys_writev+0x58/0x8c
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    -> #3 (&(&port->lock)->rlock){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock_irqsave+0x7c/0x9c
    tty_port_tty_get+0x24/0x60
    tty_port_default_wakeup+0x1c/0x3c
    tty_port_tty_wakeup+0x34/0x40
    uart_write_wakeup+0x28/0x44
    pl011_tx_chars+0x1b8/0x270
    pl011_start_tx+0x24/0x70
    __uart_start+0x5c/0x68
    uart_write+0x164/0x1c8
    do_output_char+0x33c/0x348
    n_tty_write+0x4bc/0x60c
    tty_write+0x338/0x474
    redirected_tty_write+0xc0/0xdc
    do_loop_readv_writev+0x140/0x180
    do_iter_write+0xe0/0x10c
    vfs_writev+0x134/0x1cc
    do_writev+0xbc/0x130
    __arm64_sys_writev+0x58/0x8c
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    -> #2 (&port_lock_key){-.-.}:
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    pl011_console_write+0xec/0x2cc
    console_unlock+0x794/0x96c
    vprintk_emit+0x260/0x31c
    vprintk_default+0x54/0x7c
    vprintk_func+0x218/0x254
    printk+0x7c/0xa4
    register_console+0x734/0x7b0
    uart_add_one_port+0x734/0x834
    pl011_register_port+0x6c/0xac
    sbsa_uart_probe+0x234/0x2ec
    platform_drv_probe+0xd4/0x124
    really_probe+0x250/0x71c
    driver_probe_device+0xb4/0x200
    __device_attach_driver+0xd8/0x188
    bus_for_each_drv+0xbc/0x110
    __device_attach+0x120/0x220
    device_initial_probe+0x20/0x2c
    bus_probe_device+0x54/0x100
    device_add+0xae8/0xc2c
    platform_device_add+0x278/0x3b8
    platform_device_register_full+0x238/0x2ac
    acpi_create_platform_device+0x2dc/0x3a8
    acpi_bus_attach+0x390/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_attach+0x108/0x3cc
    acpi_bus_scan+0x7c/0xb0
    acpi_scan_init+0xe4/0x304
    acpi_init+0x100/0x114
    do_one_initcall+0x348/0x6a0
    do_initcall_level+0x190/0x1fc
    do_basic_setup+0x34/0x4c
    kernel_init_freeable+0x19c/0x260
    kernel_init+0x18/0x338
    ret_from_fork+0x10/0x18

    -> #1 (console_owner){-...}:
    lock_acquire+0x320/0x360
    console_lock_spinning_enable+0x6c/0x7c
    console_unlock+0x4f8/0x96c
    vprintk_emit+0x260/0x31c
    vprintk_default+0x54/0x7c
    vprintk_func+0x218/0x254
    printk+0x7c/0xa4
    get_random_u64+0x1c4/0x1dc
    shuffle_pick_tail+0x40/0xac
    __free_one_page+0x424/0x710
    free_one_page+0x70/0x120
    __free_pages_ok+0x61c/0xa94
    __free_pages_core+0x1bc/0x294
    memblock_free_pages+0x38/0x48
    __free_pages_memory+0xcc/0xfc
    __free_memory_core+0x70/0x78
    free_low_memory_core_early+0x148/0x18c
    memblock_free_all+0x18/0x54
    mem_init+0xb4/0x17c
    mm_init+0x14/0x38
    start_kernel+0x19c/0x530

    -> #0 (&(&zone->lock)->rlock){..-.}:
    validate_chain+0xf6c/0x2e2c
    __lock_acquire+0x868/0xc2c
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    rmqueue+0x138/0x2050
    get_page_from_freelist+0x474/0x688
    __alloc_pages_nodemask+0x3b4/0x18dc
    alloc_pages_current+0xd0/0xe0
    alloc_slab_page+0x2b4/0x5e0
    new_slab+0xc8/0x6bc
    ___slab_alloc+0x3b8/0x640
    kmem_cache_alloc+0x4b4/0x588
    __debug_object_init+0x778/0x8b4
    debug_object_init_on_stack+0x40/0x50
    start_flush_work+0x16c/0x3f0
    __flush_work+0xb8/0x124
    flush_work+0x20/0x30
    xlog_cil_force_lsn+0x88/0x204 [xfs]
    xfs_log_force_lsn+0x128/0x1b8 [xfs]
    xfs_file_fsync+0x3c4/0x488 [xfs]
    vfs_fsync_range+0xb0/0xd0
    generic_write_sync+0x80/0xa0 [xfs]
    xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
    xfs_file_write_iter+0x1a0/0x218 [xfs]
    __vfs_write+0x1cc/0x214
    vfs_write+0x12c/0x1a4
    ksys_write+0xb0/0x120
    __arm64_sys_write+0x54/0x88
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    other info that might help us debug this:

    Chain exists of:
    &(&zone->lock)->rlock --> &(&port->lock)->rlock --> &pool->lock/1

    Possible unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(&pool->lock/1);
    lock(&(&port->lock)->rlock);
    lock(&pool->lock/1);
    lock(&(&zone->lock)->rlock);

    *** DEADLOCK ***

    4 locks held by doio/49441:
    #0: a0ff00886fc27408 (sb_writers#8){.+.+}, at: vfs_write+0x118/0x1a4
    #1: 8fff00080810dfe0 (&xfs_nondir_ilock_class){++++}, at:
    xfs_ilock+0x2a8/0x300 [xfs]
    #2: ffff9000129f2390 (rcu_read_lock){....}, at:
    rcu_lock_acquire+0x8/0x38
    #3: 60ff000822352818 (&pool->lock/1){-.-.}, at:
    start_flush_work+0xd8/0x3f0

    stack backtrace:
    CPU: 48 PID: 49441 Comm: doio Tainted: G W
    Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS
    L50_5.13_1.11 06/18/2019
    Call trace:
    dump_backtrace+0x0/0x248
    show_stack+0x20/0x2c
    dump_stack+0xe8/0x150
    print_circular_bug+0x368/0x380
    check_noncircular+0x28c/0x294
    validate_chain+0xf6c/0x2e2c
    __lock_acquire+0x868/0xc2c
    lock_acquire+0x320/0x360
    _raw_spin_lock+0x64/0x80
    rmqueue+0x138/0x2050
    get_page_from_freelist+0x474/0x688
    __alloc_pages_nodemask+0x3b4/0x18dc
    alloc_pages_current+0xd0/0xe0
    alloc_slab_page+0x2b4/0x5e0
    new_slab+0xc8/0x6bc
    ___slab_alloc+0x3b8/0x640
    kmem_cache_alloc+0x4b4/0x588
    __debug_object_init+0x778/0x8b4
    debug_object_init_on_stack+0x40/0x50
    start_flush_work+0x16c/0x3f0
    __flush_work+0xb8/0x124
    flush_work+0x20/0x30
    xlog_cil_force_lsn+0x88/0x204 [xfs]
    xfs_log_force_lsn+0x128/0x1b8 [xfs]
    xfs_file_fsync+0x3c4/0x488 [xfs]
    vfs_fsync_range+0xb0/0xd0
    generic_write_sync+0x80/0xa0 [xfs]
    xfs_file_buffered_aio_write+0x66c/0x6e4 [xfs]
    xfs_file_write_iter+0x1a0/0x218 [xfs]
    __vfs_write+0x1cc/0x214
    vfs_write+0x12c/0x1a4
    ksys_write+0xb0/0x120
    __arm64_sys_write+0x54/0x88
    el0_svc_handler+0x170/0x240
    el0_sync_handler+0x150/0x250
    el0_sync+0x164/0x180

    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Qian Cai
    Link: https://lore.kernel.org/r/1573679785-21068-1-git-send-email-cai@lca.pw
    Signed-off-by: Theodore Ts'o

    Sergey Senozhatsky
     

07 Jan, 2020

3 commits

  • There has been a bunch of reports (one from kernel bugzilla linked)
    reporting that when this commit is applied it causes on some machines
    boot freezes.

    Unfortunately hardware where this commit causes a failure is not widely
    available (only one I'm aware is Lenovo T490), which means we cannot
    predict yet how long it will take to properly fix tpm_tis interrupt
    probing.

    Thus, the least worst short term action is to revert the code to the
    state before this commit. In long term we need fix the tpm_tis probing
    code to work on machines that Stefan's fix was supposed to fix.

    Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
    Cc: stable@vger.kernel.org
    Cc: Jerry Snitselaar
    Cc: Dan Williams
    Tested-by: Dan Williams
    Tested-by: Xiaoping Zhou
    Signed-off-by: Stefan Berger
    Reported-by: Jerry Snitselaar
    Signed-off-by: Jarkko Sakkinen

    Stefan Berger
     
  • There has been a bunch of reports (one from kernel bugzilla linked)
    reporting that when this commit is applied it causes on some machines
    boot freezes.

    Unfortunately hardware where this commit causes a failure is not widely
    available (only one I'm aware is Lenovo T490), which means we cannot
    predict yet how long it will take to properly fix tpm_tis interrupt
    probing.

    Thus, the least worst short term action is to revert the code to the
    state before this commit. In long term we need fix the tpm_tis probing
    code to work on machines that Stefan's fix was supposed to fix.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
    Fixes: 1ea32c83c699 ("tpm_tis_core: Set TPM_CHIP_FLAG_IRQ before probing for interrupts")
    Cc: stable@vger.kernel.org
    Cc: Jerry Snitselaar
    Cc: Dan Williams
    Tested-by: Dan Williams
    Tested-by: Xiaoping Zhou
    Signed-off-by: Stefan Berger
    Reported-by: Jerry Snitselaar
    Signed-off-by: Jarkko Sakkinen

    Stefan Berger
     
  • Revert a commit, which was included in Linux v5.5-rc3 because it did not
    properly fix the issues it was supposed to fix.

    Fixes: 21df4a8b6018 ("tpm_tis: reserve chip for duration of tpm_tis_core_init")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=205935
    Cc: stable@vger.kernel.org
    Cc: Jerry Snitselaar
    Cc: Dan Williams
    Tested-by: Dan Williams
    Tested-by: Xiaoping Zhou
    Signed-off-by: Jarkko Sakkinen

    Jarkko Sakkinen
     

06 Jan, 2020

1 commit


03 Jan, 2020

2 commits

  • This patch fix the following warning:
    drivers/char/agp/isoch.c: In function ‘agp_3_5_enable’:
    drivers/char/agp/isoch.c:322:13: warning: variable ‘arqsz’ set but not
    used [-Wunused-but-set-variable]
    u32 isoch, arqsz;
    ^~~~~

    Signed-off-by: Yunfeng Ye
    Signed-off-by: Dave Airlie

    Yunfeng Ye
     
  • This patch fix the following warning:
    drivers/char/agp/isoch.c: In function ‘agp_3_5_isochronous_node_enable’:
    drivers/char/agp/isoch.c:87:5: warning: variable ‘mcapndx’ set but not
    used [-Wunused-but-set-variable]
    u8 mcapndx;
    ^~~~~~~

    Signed-off-by: Yunfeng Ye
    Signed-off-by: Dave Airlie

    Yunfeng Ye
     

23 Dec, 2019

1 commit


21 Dec, 2019

1 commit

  • Pull char/misc driver fixes from Greg KH:
    "Here are some small char and other driver fixes for 5.5-rc3.

    The most noticable one is a much-reported fix for a random driver
    issue that came up from 5.5-rc1 compat_ioctl cleanups. The others are
    a chunk of habanalab driver fixes and intel_th driver fixes and new
    device ids.

    All have been in linux-next with no reported issues"

    * tag 'char-misc-5.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
    random: don't forget compat_ioctl on urandom
    intel_th: msu: Fix window switching without windows
    intel_th: Fix freeing IRQs
    intel_th: pci: Add Elkhart Lake SOC support
    intel_th: pci: Add Comet Lake PCH-V support
    habanalabs: remove variable 'val' set but not used
    habanalabs: rate limit error msg on waiting for CS

    Linus Torvalds
     

19 Dec, 2019

1 commit

  • Add shutdown call back to close existing session with fTPM TA
    to support kexec scenario.

    Add parentheses to function names in comments as specified in kdoc.

    Signed-off-by: Thirupathaiah Annapureddy
    Signed-off-by: Pavel Tatashin
    Reviewed-by: Jarkko Sakkinen
    Tested-by: Sasha Levin
    Signed-off-by: Jarkko Sakkinen

    Pavel Tatashin
     

18 Dec, 2019

1 commit

  • Recently, there's been some compat ioctl cleanup, in which large
    hardcoded lists were replaced with compat_ptr_ioctl. One of these
    changes involved removing the random.c hardcoded list entries and adding
    a compat ioctl function pointer to the random.c fops. In the process,
    urandom was forgotten about, so this commit fixes that oversight.

    Fixes: 507e4e2b430b ("compat_ioctl: remove /dev/random commands")
    Cc: Arnd Bergmann
    Signed-off-by: Jason A. Donenfeld
    Link: https://lore.kernel.org/r/20191217172455.186395-1-Jason@zx2c4.com
    Signed-off-by: Greg Kroah-Hartman

    Jason A. Donenfeld
     

17 Dec, 2019

2 commits

  • When an application sends TPM commands in NONBLOCKING mode
    the driver holds chip->tpm_mutex returning from write(),
    which triggers: "WARNING: lock held when returning to user space".
    To fix this issue the driver needs to release the mutex before
    returning and acquire it again in tpm_dev_async_work() before
    sending the command.

    Cc: stable@vger.kernel.org
    Fixes: 9e1b74a63f776 (tpm: add support for nonblocking operation)
    Reported-by: Jeffrin Jose T
    Tested-by: Jeffrin Jose T
    Signed-off-by: Tadeusz Struk
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    Tadeusz Struk
     
  • The original code, before it was moved into security/keys/trusted-keys
    had a flush after the blob unseal. Without that flush, the volatile
    handles increase in the TPM until it becomes unusable and the system
    either has to be rebooted or the TPM volatile area manually flushed.
    Fix by adding back the lost flush, which we now have to export because
    of the relocation of the trusted key code may cause the consumer to be
    modular.

    Signed-off-by: James Bottomley
    Fixes: 2e19e10131a0 ("KEYS: trusted: Move TPM2 trusted keys code")
    Reviewed-by: Jerry Snitselaar
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    James Bottomley