Skip to content
  1. May 22, 2020
    • Gustavo A. R. Silva's avatar
      tpm: eventlog: Replace zero-length array with flexible-array member · ab91c2a8
      Gustavo A. R. Silva authored
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      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
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type[1]. There are some instances of code in
      which the sizeof operator is being incorrectly/erroneously applied to
      zero-length arrays and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also
      help to get completely rid of those sorts of issues.
      
      Also, the following issue shows up due to the flexible-array member
      having incomplete type[4]:
      
      drivers/char/tpm/eventlog/tpm2.c: In function ‘tpm2_bios_measurements_start’:
      drivers/char/tpm/eventlog/tpm2.c:54:46: error: invalid application of ‘sizeof’ to incomplete type ‘u8[]’ {aka ‘unsigned char[]’}
         54 |  size = sizeof(struct tcg_pcr_event) - sizeof(event_header->event)
            |                                              ^
      drivers/char/tpm/eventlog/tpm2.c: In function ‘tpm2_bios_measurements_next’:
      drivers/char/tpm/eventlog/tpm2.c:102:10: error: invalid application of ‘sizeof’ to incomplete type ‘u8[]’ {aka ‘unsigned char[]’}
        102 |    sizeof(event_header->event) + event_header->event_size;
            |          ^
      drivers/char/tpm/eventlog/tpm2.c: In function ‘tpm2_binary_bios_measurements_show’:
      drivers/char/tpm/eventlog/tpm2.c:140:10: error: invalid application of ‘sizeof’ to incomplete type ‘u8[]’ {aka ‘unsigned char[]’}
        140 |    sizeof(event_header->event) + event_header->event_size;
            |          ^
      scripts/Makefile.build:266: recipe for target 'drivers/char/tpm/eventlog/tpm2.o' failed
      make[3]: *** [drivers/char/tpm/eventlog/tpm2.o] Error 1
      
      As mentioned above: "Flexible array members have incomplete type, and
      so the sizeof operator may not be applied. As a quirk of the original
      implementation of zero-length arrays, sizeof evaluates to zero."[1] As
      in "sizeof(event_header->event) always evaluated to 0, so removing it
      has no effect".
      
      Lastly, make use of the struct_size() helper to deal with the
      flexible array member and its host structure.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732
      
       ("cxgb3/l2t: Fix undefined behaviour")
      [4] https://github.com/KSPP/linux/issues/43
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      ab91c2a8
    • Andy Shevchenko's avatar
      tpm/tpm_ftpm_tee: Use UUID API for exporting the UUID · 8c872863
      Andy Shevchenko authored
      
      
      There is export_uuid() function which exports uuid_t to the u8 array.
      Use it instead of open coding variant.
      
      This allows to hide the uuid_t internals.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      8c872863
    • Linus Torvalds's avatar
      Merge tag 'apparmor-pr-2020-05-21' of... · 051143e1
      Linus Torvalds authored
      Merge tag 'apparmor-pr-2020-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
      
      Pull apparmor bug fixes from John Johansen:
      
       - Fix use-after-free in aa_audit_rule_init
      
       - Fix refcnt leak in policy_update
      
       - Fix potential label refcnt leak in aa_change_profile
      
      * tag 'apparmor-pr-2020-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor:
        apparmor: Fix use-after-free in aa_audit_rule_init
        apparmor: Fix aa_label refcnt leak in policy_update
        apparmor: fix potential label refcnt leak in aa_change_profile
      051143e1
    • Namjae Jeon's avatar
      exfat: add the dummy mount options to be backward compatible with staging/exfat · 907fa893
      Namjae Jeon authored
      
      
      As Ubuntu and Fedora release new version used kernel version equal to or
      higher than v5.4, They started to support kernel exfat filesystem.
      
      Linus reported a mount error with new version of exfat on Fedora:
      
              exfat: Unknown parameter 'namecase'
      
      This is because there is a difference in mount option between old
      staging/exfat and new exfat.  And utf8, debug, and codepage options as
      well as namecase have been removed from new exfat.
      
      This patch add the dummy mount options as deprecated option to be
      backward compatible with old one.
      
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Sandeen <sandeen@sandeen.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      907fa893
    • Navid Emamdoost's avatar
      apparmor: Fix use-after-free in aa_audit_rule_init · c54d481d
      Navid Emamdoost authored
      In the implementation of aa_audit_rule_init(), when aa_label_parse()
      fails the allocated memory for rule is released using
      aa_audit_rule_free(). But after this release, the return statement
      tries to access the label field of the rule which results in
      use-after-free. Before releasing the rule, copy errNo and return it
      after release.
      
      Fixes: 52e8c380
      
       ("apparmor: Fix memory leak of rule on error exit path")
      Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      c54d481d
    • Xiyu Yang's avatar
      apparmor: Fix aa_label refcnt leak in policy_update · c6b39f07
      Xiyu Yang authored
      policy_update() invokes begin_current_label_crit_section(), which
      returns a reference of the updated aa_label object to "label" with
      increased refcount.
      
      When policy_update() returns, "label" becomes invalid, so the refcount
      should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      policy_update(). When aa_may_manage_policy() returns not NULL, the
      refcnt increased by begin_current_label_crit_section() is not decreased,
      causing a refcnt leak.
      
      Fix this issue by jumping to "end_section" label when
      aa_may_manage_policy() returns not NULL.
      
      Fixes: 5ac8c355
      
       ("apparmor: allow introspecting the loaded policy pre internal transform")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      c6b39f07
    • Xiyu Yang's avatar
      apparmor: fix potential label refcnt leak in aa_change_profile · a0b845ff
      Xiyu Yang authored
      aa_change_profile() invokes aa_get_current_label(), which returns
      a reference of the current task's label.
      
      According to the comment of aa_get_current_label(), the returned
      reference must be put with aa_put_label().
      However, when the original object pointed by "label" becomes
      unreachable because aa_change_profile() returns or a new object
      is assigned to "label", reference count increased by
      aa_get_current_label() is not decreased, causing a refcnt leak.
      
      Fix this by calling aa_put_label() before aa_change_profile() return
      and dropping unnecessary aa_get_current_label().
      
      Fixes: 9fcf78cc
      
       ("apparmor: update domain transitions that are subsets of confinement at nnp")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      a0b845ff
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · d2f8825a
      Linus Torvalds authored
      Pull virtio fixes from Michael Tsirkin:
       "Fix a couple of build warnings"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost: missing __user tags
        vdpasim: remove unused variable 'ret'
      d2f8825a
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-5.7-rc7' of git://git.infradead.org/users/vkoul/slave-dma · cedd54f7
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "Some driver fixes:
      
         - dmatest restoration of defaults
      
         - tegra210-adma probe handling fix
      
         - k3-udma flags fixed for slave_sg and memcpy
      
         - list fix for zynqmp_dma
      
         - idxd interrupt completion fix
      
         - lock fix for owl"
      
      * tag 'dmaengine-fix-5.7-rc7' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
        dmaengine: ti: k3-udma: Fix TR mode flags for slave_sg and memcpy
        dmaengine: zynqmp_dma: Move list_del inside zynqmp_dma_free_descriptor.
        dmaengine: dmatest: Restore default for channel
        dmaengine: idxd: fix interrupt completion after unmasking
        dmaengine: owl: Use correct lock in owl_dma_get_pchan()
      cedd54f7
    • Linus Torvalds's avatar
      Merge tag 'fiemap-regression-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 57f1b0cf
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Fix regression in ext4's FIEMAP handling introduced in v5.7-rc1"
      
      * tag 'fiemap-regression-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fix fiemap size checks for bitmap files
        ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
      57f1b0cf
  2. May 21, 2020
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · b85051e7
      Linus Torvalds authored
      Pull MTD fixes from Richard Weinberger:
      
       - Fix a PM regression in brcmnand driver
      
       - Propagate ECC information correctly on SPI-NAND
      
       - Make sure no MTD name is used multiple time in nvmem
      
      * tag 'fixes-for-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd:rawnand: brcmnand: Fix PM resume crash
        mtd: Fix mtd not registered due to nvmem name collision
        mtd: spinand: Propagate ECC information to the MTD structure
      b85051e7
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · fea371e2
      Linus Torvalds authored
      Pull UBI and UBIFS fixes from Richard Weinberger:
      
       - Correctly set next cursor for detailed_erase_block_info debugfs file
      
       - Don't use crypto_shash_descsize() for digest size in UBIFS
      
       - Remove broken lazytime support from UBIFS
      
      * tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
        ubifs: fix wrong use of crypto_shash_descsize()
        ubifs: remove broken lazytime support
      fea371e2
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml · d303402c
      Linus Torvalds authored
      Pull UML fixes from Richard Weinberger:
      
       - Two missing includes which caused build issues on recent systems
      
       - Correctly set TRANS_GRE_LEN in our vector network driver
      
      * tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
        um: Fix typo in vector driver transport option definition
        um: syscall.c: include <asm/unistd.h>
        um: Fix xor.h include
      d303402c
    • Linus Torvalds's avatar
      Merge tag 'pm-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2ea1940b
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "This makes a recently introduced suspend-to-idle wakeup issue on Dell
        XPS13 9360 go away"
      
      * tag 'pm-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive
      2ea1940b
    • Linus Torvalds's avatar
      Merge tag 'ovl-fixes-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs · 8e2b7f63
      Linus Torvalds authored
      Pull overlayfs fixes from Miklos Szeredi:
       "Fix two bugs introduced in this cycle and one introduced in v5.5"
      
      * tag 'ovl-fixes-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
        ovl: potential crash in ovl_fid_to_fh()
        ovl: clear ATTR_OPEN from attr->ia_valid
        ovl: clear ATTR_FILE from attr->ia_valid
      8e2b7f63
    • Tetsuo Handa's avatar
      pipe: Fix pipe_full() test in opipe_prep(). · 566d1362
      Tetsuo Handa authored
      
      
      syzbot is reporting that splice()ing from non-empty read side to
      already-full write side causes unkillable task, for opipe_prep() is by
      error not inverting pipe_full() test.
      
        CPU: 0 PID: 9460 Comm: syz-executor.5 Not tainted 5.6.0-rc3-next-20200228-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        RIP: 0010:rol32 include/linux/bitops.h:105 [inline]
        RIP: 0010:iterate_chain_key kernel/locking/lockdep.c:369 [inline]
        RIP: 0010:__lock_acquire+0x6a3/0x5270 kernel/locking/lockdep.c:4178
        Call Trace:
           lock_acquire+0x197/0x420 kernel/locking/lockdep.c:4720
           __mutex_lock_common kernel/locking/mutex.c:956 [inline]
           __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
           pipe_lock_nested fs/pipe.c:66 [inline]
           pipe_double_lock+0x1a0/0x1e0 fs/pipe.c:104
           splice_pipe_to_pipe fs/splice.c:1562 [inline]
           do_splice+0x35f/0x1520 fs/splice.c:1141
           __do_sys_splice fs/splice.c:1447 [inline]
           __se_sys_splice fs/splice.c:1427 [inline]
           __x64_sys_splice+0x2b5/0x320 fs/splice.c:1427
           do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:295
           entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Reported-by: default avatar <syzbot+b48daca8639150bc5e73@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?id=9386d051e11e09973d5a4cf79af5e8cedf79386d
      Fixes: 8cefc107
      
       ("pipe: Use head and tail pointers for the ring, not cursor and length")
      Cc: stable@vger.kernel.org # 5.5+
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      566d1362
  3. May 20, 2020
  4. May 19, 2020
    • Joerg Roedel's avatar
      iommu: Fix deferred domain attachment · bd421264
      Joerg Roedel authored
      The IOMMU core code has support for deferring the attachment of a domain
      to a device. This is needed in kdump kernels where the new domain must
      not be attached to a device before the device driver takes it over.
      
      When the AMD IOMMU driver got converted to use the dma-iommu
      implementation, the deferred attaching got lost. The code in
      dma-iommu.c has support for deferred attaching, but it calls into
      iommu_attach_device() to actually do it. But iommu_attach_device()
      will check if the device should be deferred in it code-path and do
      nothing, breaking deferred attachment.
      
      Move the is_deferred_attach() check out of the attach_device path and
      into iommu_group_add_device() to make deferred attaching work from the
      dma-iommu code.
      
      Fixes: 795bbbb9
      
       ("iommu/dma-iommu: Handle deferred devices")
      Reported-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Suggested-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Tested-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
      Cc: Jerry Snitselaar <jsnitsel@redhat.com>
      Cc: Tom Murphy <murphyt7@tcd.ie>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Link: https://lore.kernel.org/r/20200519130340.14564-1-joro@8bytes.org
      bd421264
    • Kamal Dasu's avatar
      mtd:rawnand: brcmnand: Fix PM resume crash · f3a6a6c5
      Kamal Dasu authored
      This change fixes crash observed on PM resume. This bug
      was introduced in the change made for flash-edu support.
      
      Fixes: a5d53ad2
      
       ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers")
      
      Signed-off-by: default avatarKamal Dasu <kdasu.kdev@gmail.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      f3a6a6c5
    • Ricardo Ribalda Delgado's avatar
      mtd: Fix mtd not registered due to nvmem name collision · 7b01b723
      Ricardo Ribalda Delgado authored
      When the nvmem framework is enabled, a nvmem device is created per mtd
      device/partition.
      
      It is not uncommon that a device can have multiple mtd devices with
      partitions that have the same name. Eg, when there DT overlay is allowed
      and the same device with mtd is attached twice.
      
      Under that circumstances, the mtd fails to register due to a name
      duplication on the nvmem framework.
      
      With this patch we use the mtdX name instead of the partition name,
      which is unique.
      
      [    8.948991] sysfs: cannot create duplicate filename '/bus/nvmem/devices/Production Data'
      [    8.948992] CPU: 7 PID: 246 Comm: systemd-udevd Not tainted 5.5.0-qtec-standard #13
      [    8.948993] Hardware name: AMD Dibbler/Dibbler, BIOS 05.22.04.0019 10/26/2019
      [    8.948994] Call Trace:
      [    8.948996]  dump_stack+0x50/0x70
      [    8.948998]  sysfs_warn_dup.cold+0x17/0x2d
      [    8.949000]  sysfs_do_create_link_sd.isra.0+0xc2/0xd0
      [    8.949002]  bus_add_device+0x74/0x140
      [    8.949004]  device_add+0x34b/0x850
      [    8.949006]  nvmem_register.part.0+0x1bf/0x640
      ...
      [    8.948926] mtd mtd8: Failed to register NVMEM device
      
      Fixes: c4dfa25a
      
       ("mtd: add support for reading MTD devices via the nvmem API")
      Signed-off-by: default avatarRicardo Ribalda Delgado <ribalda@kernel.org>
      Acked-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      7b01b723
    • Miquel Raynal's avatar
      mtd: spinand: Propagate ECC information to the MTD structure · 3507273d
      Miquel Raynal authored
      This is done by default in the raw NAND core (nand_base.c) but was
      missing in the SPI-NAND core. Without these two lines the ecc_strength
      and ecc_step_size values are not exported to the user through sysfs.
      
      Fixes: 7529df46
      
       ("mtd: nand: Add core infrastructure to support SPI NANDs")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      3507273d
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity · 642b151f
      Linus Torvalds authored
      Pull integrity fixes from Mimi Zohar:
       "A couple of miscellaneous bug fixes for the integrity subsystem:
      
        IMA:
      
         - Properly modify the open flags in order to calculate the file hash.
      
         - On systems requiring the IMA policy to be signed, the policy is
           loaded differently. Don't differentiate between "enforce" and
           either "log" or "fix" modes how the policy is loaded.
      
        EVM:
      
         - Two patches to fix an EVM race condition, normally the result of
           attempting to load an unsupported hash algorithm.
      
         - Use the lockless RCU version for walking an append only list"
      
      * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
        evm: Fix a small race in init_desc()
        evm: Fix RCU list related warnings
        ima: Fix return value of ima_write_policy()
        evm: Check also if *tfm is an error pointer in init_desc()
        ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
      642b151f
    • Linus Torvalds's avatar
      Merge tag 'for-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat · 45088963
      Linus Torvalds authored
      Pull exfat fixes from Namjae Jeon:
      
       - Fix potential memory leak in exfat_find
      
       - Set exfat's splice_write to iter_file_splice_write to fix a splice
         failure on direct-opened files
      
      * tag 'for-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
        exfat: fix possible memory leak in exfat_find()
        exfat: use iter_file_splice_write
      45088963
    • David Howells's avatar
      afs: Don't unlock fetched data pages until the op completes successfully · 9d1be4f4
      David Howells authored
      Don't call req->page_done() on each page as we finish filling it with
      the data coming from the network.  Whilst this might speed up the
      application a bit, it's a problem if there's a network failure and the
      operation has to be reissued.
      
      If this happens, an oops occurs because afs_readpages_page_done() clears
      the pointer to each page it unlocks and when a retry happens, the
      pointers to the pages it wants to fill are now NULL (and the pages have
      been unlocked anyway).
      
      Instead, wait till the operation completes successfully and only then
      release all the pages after clearing any terminal gap (the server can
      give us less data than we requested as we're allowed to ask for more
      than is available).
      
      KASAN produces a bug like the following, and even without KASAN, it can
      oops and panic.
      
          BUG: KASAN: wild-memory-access in _copy_to_iter+0x323/0x5f4
          Write of size 1404 at addr 0005088000000000 by task md5sum/5235
      
          CPU: 0 PID: 5235 Comm: md5sum Not tainted 5.7.0-rc3-fscache+ #250
          Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
          Call Trace:
           memcpy+0x39/0x58
           _copy_to_iter+0x323/0x5f4
           __skb_datagram_iter+0x89/0x2a6
           skb_copy_datagram_iter+0x129/0x135
           rxrpc_recvmsg_data.isra.0+0x615/0xd42
           rxrpc_kernel_recv_data+0x1e9/0x3ae
           afs_extract_data+0x139/0x33a
           yfs_deliver_fs_fetch_data64+0x47a/0x91b
           afs_deliver_to_call+0x304/0x709
           afs_wait_for_call_to_complete+0x1cc/0x4ad
           yfs_fs_fetch_data+0x279/0x288
           afs_fetch_data+0x1e1/0x38d
           afs_readpages+0x593/0x72e
           read_pages+0xf5/0x21e
           __do_page_cache_readahead+0x128/0x23f
           ondemand_readahead+0x36e/0x37f
           generic_file_buffered_read+0x234/0x680
           new_sync_read+0x109/0x17e
           vfs_read+0xe6/0x138
           ksys_read+0xd8/0x14d
           do_syscall_64+0x6e/0x8a
           entry_SYSCALL_64_after_hwframe+0x49/0xb3
      
      Fixes: 196ee9cd ("afs: Make afs_fs_fetch_data() take a list of pages")
      Fixes: 30062bd1
      
       ("afs: Implement YFS support in the fs client")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9d1be4f4
  5. May 18, 2020
    • Rafael J. Wysocki's avatar
      ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive · 607b9df6
      Rafael J. Wysocki authored
      Flushing the EC work while suspended to idle when the EC GPE status
      is not set causes some EC wakeup events (notably power button and
      lid ones) to be missed after a series of spurious wakeups on the Dell
      XPS13 9360 in my office.
      
      If that happens, the machine cannot be woken up from suspend-to-idle
      by the power button or lid status change and it needs to be woken up
      in some other way (eg. by a key press).
      
      Flushing the EC work only after successful dispatching the EC GPE,
      which means that its status has been set, avoids the issue, so change
      the code in question accordingly.
      
      Fixes: 7b301750
      
       ("ACPI: EC: PM: Avoid premature returns from acpi_s2idle_wake()")
      Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: default avatarChris Chiu <chiu@endlessm.com>
      607b9df6
    • Wei Yongjun's avatar
      exfat: fix possible memory leak in exfat_find() · 94182167
      Wei Yongjun authored
      'es' is malloced from exfat_get_dentry_set() in exfat_find() and should
      be freed before leaving from the error handling cases, otherwise it will
      cause memory leak.
      
      Fixes: 5f2aa075
      
       ("exfat: add inode operations")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      94182167
    • Eric Sandeen's avatar
      exfat: use iter_file_splice_write · 03577948
      Eric Sandeen authored
      
      
      Doing copy_file_range() on exfat with a file opened for direct IO leads
      to an -EFAULT:
      
      # xfs_io -f -d -c "truncate 32768" \
             -c "copy_range -d 16384 -l 16384 -f 0" /mnt/test/junk
      copy_range: Bad address
      
      and the reason seems to be that we go through:
      
      default_file_splice_write
       splice_from_pipe
        __splice_from_pipe
         write_pipe_buf
          __kernel_write
           new_sync_write
            generic_file_write_iter
             generic_file_direct_write
              exfat_direct_IO
               do_blockdev_direct_IO
                iov_iter_get_pages
      
      and land in iterate_all_kinds(), which does "return -EFAULT" for our kvec
      iter.
      
      Setting exfat's splice_write to iter_file_splice_write fixes this and lets
      fsx (which originally detected the problem) run to success from
      the xfstests harness.
      
      Signed-off-by: default avatarEric Sandeen <sandeen@sandeen.net>
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      03577948
    • Linus Torvalds's avatar
      Linux 5.7-rc6 · b9bbe6ed
      Linus Torvalds authored
      b9bbe6ed
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.7-2' of git://github.com/cminyard/linux-ipmi · 8feea623
      Linus Torvalds authored
      Pull IPMI update from Corey Minyard:
       "Convert i2c_new_device() to i2c_new_client_device()
      
        Wolfram Sang has asked to have this included in 5.7 so the deprecated
        API can be removed next release. There should be no functional
        difference.
      
        I think that entire this section of code can be removed; it is
        leftover from other things that have since changed, but this is the
        safer thing to do for now. The full removal can happen next release"
      
      * tag 'for-linus-5.7-2' of git://github.com/cminyard/linux-ipmi:
        char: ipmi: convert to use i2c_new_client_device()
      8feea623
    • Richard Weinberger's avatar
      ubi: Fix seq_file usage in detailed_erase_block_info debugfs file · 0e7572cf
      Richard Weinberger authored
      3bfa7e14 ("fs/seq_file.c: seq_read(): add info message about buggy .next functions")
      showed that we don't use seq_file correctly.
      So make sure that our ->next function always updates the position.
      
      Fixes: 7bccd12d
      
       ("ubi: Add debugfs file for tracking PEB state")
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      0e7572cf
    • Eric Biggers's avatar
      ubifs: fix wrong use of crypto_shash_descsize() · 3c3c32f8
      Eric Biggers authored
      crypto_shash_descsize() returns the size of the shash_desc context
      needed to compute the hash, not the size of the hash itself.
      
      crypto_shash_digestsize() would be correct, or alternatively using
      c->hash_len and c->hmac_desc_len which already store the correct values.
      But actually it's simpler to just use stack arrays, so do that instead.
      
      Fixes: 49525e5e ("ubifs: Add helper functions for authentication support")
      Fixes: da8ef65f
      
       ("ubifs: Authenticate replayed journal")
      Cc: <stable@vger.kernel.org> # v4.20+
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      3c3c32f8