1. 09 Aug, 2019 17 commits
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-08-09' of git://anongit.freedesktop.org/drm/drm · 2226fb57
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Usual fixes roundup. Nothing too crazy or serious, one non-released
        ioctl is removed in the amdkfd driver.
      
        core:
         - mode parser strncpy fix
      
        i915:
         - GLK DSI escape clock setting
         - HDCP memleak fix
      
        tegra:
         - one gpiod/of regression fix
      
        amdgpu:
         - fix VCN to handle the latest navi10 firmware
         - fix for fan control on navi10
         - properly handle SMU metrics table on navi10
         - fix a resume regression on Stoney
         - kfd revert a GWS ioctl
      
        vmwgfx:
         - memory leak fix
      
        rockchip:
         - suspend fix"
      
      * tag 'drm-fixes-2019-08-09' of git://anongit.freedesktop.org/drm/drm:
        drm/vmwgfx: fix memory leak when too many retries have occurred
        Revert "drm/amdkfd: New IOCTL to allocate queue GWS"
        Revert "drm/amdgpu: fix transform feedback GDS hang on gfx10 (v2)"
        drm/amdgpu: pin the csb buffer on hw init for gfx v8
        drm/rockchip: Suspend DP late
        drm/i915: Fix wrong escape clock divisor init for GLK
        drm/i915: fix possible memory leak in intel_hdcp_auth_downstream()
        drm/modes: Fix unterminated strncpy
        drm/amd/powerplay: correct navi10 vcn powergate
        drm/amd/powerplay: honor hw limit on fetching metrics data for navi10
        drm/amd/powerplay: Allow changing of fan_control in smu_v11_0
        drm/amd/amdgpu/vcn_v2_0: Move VCN 2.0 specific dec ring test to vcn_v2_0
        drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands
        drm/tegra: Fix gpiod_get_from_of_node() regression
      2226fb57
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 15a555a4
      Linus Torvalds authored
      Pull arm64 fix from Catalin Marinas:
       "Fix bad_pte warning caused by pte_mkdevmap() not setting PTE_SPECIAL"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: mm: add missing PTE_SPECIAL in pte_mkdevmap on arm64
      15a555a4
    • Linus Torvalds's avatar
      Merge tag 's390-5.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · cb7ef4bc
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - Map vdso also for statically linked binaries like all other
         architectures.
      
       - Fix no .bss usage compile-time check to account common objects with
         the help of binutils size tool. Top level Makefile change acked-by
         Masahiro.
      
       - A fix to make perf happy with _etext symbol type.
      
       - Fix dump_pagetables which is broken since p*d_offset implementation
         change to comply with mm/gup.c expectations.
      
       - Revert memory sharing for diag calls in protected virtualization,
         since this is not required after all.
      
       - Couple of other minor code cleanups.
      
      * tag 's390-5.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/vdso: map vdso also for statically linked binaries
        s390/build: use size command to perform empty .bss check
        kbuild: add OBJSIZE variable for the size tool
        s390: put _stext and _etext into .text section
        s390/head64: cleanup unused labels
        s390/unwind: remove stack recursion warning
        s390/setup: adjust start_code of init_mm to _text
        s390/mm: fix dump_pagetables top level page table walking
        s390/protvirt: avoid memory sharing for diag 308 set/store
      cb7ef4bc
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190809' of git://git.kernel.dk/linux-block · 50e73a4a
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - Revert of a bcache patch that caused an oops for some (Coly)
      
       - ata rb532 unused warning fix (Gustavo)
      
       - AoE kernel crash fix (He)
      
       - Error handling fixup for blkdev_get() (Jan)
      
       - libata read/write translation and SFF PIO fix (me)
      
       - Use after free and error handling fix for O_DIRECT fragments. There's
         still a nowait + sync oddity in there, we'll nail that start next
         week. If all else fails, I'll queue a revert of the NOWAIT change.
         (me)
      
       - Loop GFP_KERNEL -> GFP_NOIO deadlock fix (Mikulas)
      
       - Two BFQ regression fixes that caused crashes (Paolo)
      
      * tag 'for-linus-20190809' of git://git.kernel.dk/linux-block:
        bcache: Revert "bcache: use sysfs_match_string() instead of __sysfs_match_string()"
        loop: set PF_MEMALLOC_NOIO for the worker thread
        bdev: Fixup error handling in blkdev_get()
        block, bfq: handle NULL return value by bfq_init_rq()
        block, bfq: move update of waker and woken list to queue freeing
        block, bfq: reset last_completed_rq_bfqq if the pointed queue is freed
        block: aoe: Fix kernel crash due to atomic sleep when exiting
        libata: add SG safety checks in SFF pio transfers
        libata: have ata_scsi_rw_xlat() fail invalid passthrough requests
        block: fix O_DIRECT error handling for bio fragments
        ata: rb532_cf: Fix unused variable warning in rb532_pata_driver_probe
      50e73a4a
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 461d2815
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
      
       - cavium: Fix DMA support
      
       - sdhci-sprd: Fix soft reset when runtime resuming"
      
      * tag 'mmc-v5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: cavium: Add the missing dma unmap when the dma has finished.
        mmc: cavium: Set the correct dma max segment size for mmc_host
        mmc: sdhci-sprd: Fix the incorrect soft reset operation when runtime resuming
      461d2815
    • Linus Torvalds's avatar
      Merge tag 'fbdev-v5.3-rc4' of git://github.com/bzolnier/linux · ec4c99ad
      Linus Torvalds authored
      Pull fbdev fix from Bartlomiej Zolnierkiewicz:
       "fbdev patches will now go to upstream through drm-misc tree for
        improved maintainership and better integration testing so update
        MAINTAINERS file accordingly"
      
      * tag 'fbdev-v5.3-rc4' of git://github.com/bzolnier/linux:
        MAINTAINERS: handle fbdev changes through drm-misc tree
      ec4c99ad
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-5.3-rc4' of... · c808f2ad
      Linus Torvalds authored
      Merge tag 'pwm/for-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm fix from Thierry Reding:
       "A single fix for a backlight brightness regression introduced in
        this merge window"
      
      * tag 'pwm/for-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
        pwm: Fallback to the static lookup-list when acpi_pwm_get fails
      c808f2ad
    • Linus Torvalds's avatar
      Merge tag 'sound-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · cb42f06c
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Lots of small fixes at this time since we've received the ASoC fix
        batch now.
      
         - Some coverage in ASoC core mostly for minor issues like NULL checks
           for DPCM and proper error handling in DAI instantiation
      
         - A collection of small device-specific changes in various ASoC codec
           and platform drivers
      
         - OF-tree refcount fixes in a few ASoC drivers
      
         - Fixes of memory leaks in the error paths of various ASoC / ALSA
           drivers
      
         - A workaround for a long-standing issue on AMD HD-audio device
      
         - Updates of MAINTAINERS, mail addresses, file permission fixups"
      
      * tag 'sound-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (38 commits)
        ALSA: firewire: fix a memory leak bug
        sound: fix a memory leak bug
        ALSA: hda - Workaround for crackled sound on AMD controller (1022:1457)
        ALSA: hiface: fix multiple memory leak bugs
        ALSA: hda - Don't override global PCM hw info flag
        ALSA: usb-audio: fix a memory leak bug
        ASoC: max98373: Remove executable bits
        ASoC: amd: acp3x: use dma address for acp3x dma driver
        ASoC: amd: acp3x: use dma_ops of parent device for acp3x dma driver
        ASoC: max98373: add 88200 and 96000 sampling rate support
        ASoC: sun4i-i2s: Incorrect SR and WSS computation
        MAINTAINERS: Update Intel ASoC drivers maintainers
        ASoC: ti: davinci-mcasp: Correct slot_width posed constraint
        ASoC: rockchip: Fix mono capture
        ASoC: Intel: Fix some acpi vs apci typo in somme comments
        ASoC: ti: davinci-mcasp: Fix clk PDIR handling for i2s master mode
        ASoC: Fail card instantiation if DAI format setup fails
        ASoC: SOF: Intel: hda: remove misleading error trace from IRQ thread
        ASoC: qcom: apq8016_sbc: Fix oops with multiple DAI links
        ASoC: dapm: fix a memory leak bug
        ...
      cb42f06c
    • Linus Torvalds's avatar
      Merge tag 'media/v5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 6c02b630
      Linus Torvalds authored
      Pull media fix from Mauro Carvalho Chehab:
       "A fix at the vivid CEC support"
      
      * tag 'media/v5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: vivid: fix missing cec adapter name
      6c02b630
    • Linus Torvalds's avatar
      Merge tag 'pm-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 0acf5676
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "Revert a recent PCI power management change that caused problems to
        occur on multiple systems (Mika Westerberg)"
      
      * tag 'pm-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        Revert "PCI: Add missing link delays required by the PCIe spec"
      0acf5676
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · e577dc15
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
       "Fix a number of bugs in the ccp driver"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: ccp - Ignore tag length when decrypting GCM ciphertext
        crypto: ccp - Add support for valid authsize values less than 16
        crypto: ccp - Fix oops by properly managing allocated structures
      e577dc15
    • Bartlomiej Zolnierkiewicz's avatar
      MAINTAINERS: handle fbdev changes through drm-misc tree · 6a7553e8
      Bartlomiej Zolnierkiewicz authored
      fbdev patches will now go to upstream through drm-misc tree (IOW
      starting with v5.4 merge window fbdev changes will be included in
      DRM pull request) for improved maintainership and better integration
      testing. Update MAINTAINERS file accordingly.
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      6a7553e8
    • Coly Li's avatar
      bcache: Revert "bcache: use sysfs_match_string() instead of __sysfs_match_string()" · 20621fed
      Coly Li authored
      This reverts commit 89e0341a.
      
      In drivers/md/bcache/sysfs.c:bch_snprint_string_list(), NULL pointer at
      the end of list is necessary. Remove the NULL from last element of each
      lists will cause the following panic,
      
      [ 4340.455652] bcache: register_cache() registered cache device nvme0n1
      [ 4340.464603] bcache: register_bdev() registered backing device sdk
      [ 4421.587335] bcache: bch_cached_dev_run() cached dev sdk is running already
      [ 4421.587348] bcache: bch_cached_dev_attach() Caching sdk as bcache0 on set 354e1d46-d99f-4d8b-870b-078b80dc88a6
      [ 5139.247950] general protection fault: 0000 [#1] SMP NOPTI
      [ 5139.247970] CPU: 9 PID: 5896 Comm: cat Not tainted 4.12.14-95.29-default #1 SLE12-SP4
      [ 5139.247988] Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 04/18/2019
      [ 5139.248006] task: ffff888fb25c0b00 task.stack: ffff9bbacc704000
      [ 5139.248021] RIP: 0010:string+0x21/0x70
      [ 5139.248030] RSP: 0018:ffff9bbacc707bf0 EFLAGS: 00010286
      [ 5139.248043] RAX: ffffffffa7e432e3 RBX: ffff8881c20da02a RCX: ffff0a00ffffff04
      [ 5139.248058] RDX: 3f00656863616362 RSI: ffff8881c20db000 RDI: ffffffffffffffff
      [ 5139.248075] RBP: ffff8881c20db000 R08: 0000000000000000 R09: ffff8881c20da02a
      [ 5139.248090] R10: 0000000000000004 R11: 0000000000000000 R12: ffff9bbacc707c48
      [ 5139.248104] R13: 0000000000000fd6 R14: ffffffffc0665855 R15: ffffffffc0665855
      [ 5139.248119] FS:  00007faf253b8700(0000) GS:ffff88903f840000(0000) knlGS:0000000000000000
      [ 5139.248137] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 5139.248149] CR2: 00007faf25395008 CR3: 0000000f72150006 CR4: 00000000007606e0
      [ 5139.248164] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 5139.248179] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [ 5139.248193] PKRU: 55555554
      [ 5139.248200] Call Trace:
      [ 5139.248210]  vsnprintf+0x1fb/0x510
      [ 5139.248221]  snprintf+0x39/0x40
      [ 5139.248238]  bch_snprint_string_list.constprop.15+0x5b/0x90 [bcache]
      [ 5139.248256]  __bch_cached_dev_show+0x44d/0x5f0 [bcache]
      [ 5139.248270]  ? __alloc_pages_nodemask+0xb2/0x210
      [ 5139.248284]  bch_cached_dev_show+0x2c/0x50 [bcache]
      [ 5139.248297]  sysfs_kf_seq_show+0xbb/0x190
      [ 5139.248308]  seq_read+0xfc/0x3c0
      [ 5139.248317]  __vfs_read+0x26/0x140
      [ 5139.248327]  vfs_read+0x87/0x130
      [ 5139.248336]  SyS_read+0x42/0x90
      [ 5139.248346]  do_syscall_64+0x74/0x160
      [ 5139.248358]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      [ 5139.248370] RIP: 0033:0x7faf24eea370
      [ 5139.248379] RSP: 002b:00007fff82d03f38 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
      [ 5139.248395] RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007faf24eea370
      [ 5139.248411] RDX: 0000000000020000 RSI: 00007faf25396000 RDI: 0000000000000003
      [ 5139.248426] RBP: 00007faf25396000 R08: 00000000ffffffff R09: 0000000000000000
      [ 5139.248441] R10: 000000007c9d4d41 R11: 0000000000000246 R12: 00007faf25396000
      [ 5139.248456] R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000fff
      [ 5139.248892] Code: ff ff ff 0f 1f 80 00 00 00 00 49 89 f9 48 89 cf 48 c7 c0 e3 32 e4 a7 48 c1 ff 30 48 81 fa ff 0f 00 00 48 0f 46 d0 48 85 ff 74 45 <44> 0f b6 02 48 8d 42 01 45 84 c0 74 38 48 01 fa 4c 89 cf eb 0e
      
      The simplest way to fix is to revert commit 89e0341a ("bcache: use
      sysfs_match_string() instead of __sysfs_match_string()").
      
      This bug was introduced in Linux v5.2, so this fix only applies to
      Linux v5.2 is enough for stable tree maintainer.
      
      Fixes: 89e0341a ("bcache: use sysfs_match_string() instead of __sysfs_match_string()")
      Cc: stable@vger.kernel.org
      Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
      Reported-by: default avatarPeifeng Lin <pflin@suse.com>
      Acked-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
      Signed-off-by: default avatarColy Li <colyli@suse.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      20621fed
    • Heiko Carstens's avatar
      s390/vdso: map vdso also for statically linked binaries · 404861e1
      Heiko Carstens authored
      s390 does not map the vdso for statically linked binaries, assuming
      that this doesn't make sense. See commit fc5243d9 ("[S390]
      arch_setup_additional_pages arguments").
      
      However with glibc commit d665367f596d ("linux: Enable vDSO for static
      linking as default (BZ#19767)") and commit 5e855c895401 ("s390: Enable
      VDSO for static linking") the vdso is also used for statically linked
      binaries - if the kernel would make it available.
      
      Therefore map the vdso always, just like all other architectures.
      Reported-by: default avatarStefan Liebler <stli@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      404861e1
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2019-08-08' of... · a111ef6b
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2019-08-08' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      drm/i915 fixes for v5.3-rc4:
      - Fix GLK DSI escape clock setting
      - Fix a memleak on HDCP revoked Ksv error path
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Jani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/87pnlghz79.fsf@intel.com
      a111ef6b
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2019-08-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 359f1dcb
      Dave Airlie authored
      drm-misc-fixes for v5.3-rc4:
      - Suspend fix for rockchip
      - Fix unterminated strncpy cmdline mode parser
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/ace294a6-6bb2-d9b1-695d-3260e1d60831@linux.intel.com
      359f1dcb
    • Dave Airlie's avatar
      6ca847a9
  2. 08 Aug, 2019 17 commits
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.3-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · b678c568
      Linus Torvalds authored
      Pull NFS client fixes from Trond Myklebust:
       "Highlights include:
      
        Stable fixes:
      
         - NFSv4: Ensure we check the return value of update_open_stateid() so
           we correctly track active open state.
      
         - NFSv4: Fix for delegation state recovery to ensure we recover all
           open modes that are active.
      
         - NFSv4: Fix an Oops in nfs4_do_setattr
      
        Fixes:
      
         - NFS: Fix regression whereby fscache errors are appearing on 'nofsc'
           mounts
      
         - NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim()
      
         - NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
      
         - pNFS: Report errors from the call to nfs4_select_rw_stateid()
      
         - NFSv4: Various other delegation and open stateid recovery fixes
      
         - NFSv4: Fix state recovery behaviour when server connection times
           out"
      
      * tag 'nfs-for-5.3-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        NFSv4: Ensure state recovery handles ETIMEDOUT correctly
        NFS: Fix regression whereby fscache errors are appearing on 'nofsc' mounts
        NFSv4: Fix an Oops in nfs4_do_setattr
        NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim()
        NFSv4: Check the return value of update_open_stateid()
        NFSv4.1: Only reap expired delegations
        NFSv4.1: Fix open stateid recovery
        NFSv4: Report the error from nfs4_select_rw_stateid()
        NFSv4: When recovering state fails with EAGAIN, retry the same recovery
        NFSv4: Print an error in the syslog when state is marked as irrecoverable
        NFSv4: Fix delegation state recovery
        NFSv4: Fix a credential refcount leak in nfs41_check_delegation_stateid
      b678c568
    • Jia He's avatar
      arm64: mm: add missing PTE_SPECIAL in pte_mkdevmap on arm64 · 30e23538
      Jia He authored
      Without this patch, the MAP_SYNC test case will cause a print_bad_pte
      warning on arm64 as follows:
      
      [   25.542693] BUG: Bad page map in process mapdax333 pte:2e8000448800f53 pmd:41ff5f003
      [   25.546360] page:ffff7e0010220000 refcount:1 mapcount:-1 mapping:ffff8003e29c7440 index:0x0
      [   25.550281] ext4_dax_aops
      [   25.550282] name:"__aaabbbcccddd__"
      [   25.551553] flags: 0x3ffff0000001002(referenced|reserved)
      [   25.555802] raw: 03ffff0000001002 ffff8003dfffa908 0000000000000000 ffff8003e29c7440
      [   25.559446] raw: 0000000000000000 0000000000000000 00000001fffffffe 0000000000000000
      [   25.563075] page dumped because: bad pte
      [   25.564938] addr:0000ffffbe05b000 vm_flags:208000fb anon_vma:0000000000000000 mapping:ffff8003e29c7440 index:0
      [   25.574272] file:__aaabbbcccddd__ fault:ext4_dax_fault mmmmap:ext4_file_mmap readpage:0x0
      [   25.578799] CPU: 1 PID: 1180 Comm: mapdax333 Not tainted 5.2.0+ #21
      [   25.581702] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      [   25.585624] Call trace:
      [   25.587008]  dump_backtrace+0x0/0x178
      [   25.588799]  show_stack+0x24/0x30
      [   25.590328]  dump_stack+0xa8/0xcc
      [   25.591901]  print_bad_pte+0x18c/0x218
      [   25.593628]  unmap_page_range+0x778/0xc00
      [   25.595506]  unmap_single_vma+0x94/0xe8
      [   25.597304]  unmap_vmas+0x90/0x108
      [   25.598901]  unmap_region+0xc0/0x128
      [   25.600566]  __do_munmap+0x284/0x3f0
      [   25.602245]  __vm_munmap+0x78/0xe0
      [   25.603820]  __arm64_sys_munmap+0x34/0x48
      [   25.605709]  el0_svc_common.constprop.0+0x78/0x168
      [   25.607956]  el0_svc_handler+0x34/0x90
      [   25.609698]  el0_svc+0x8/0xc
      [...]
      
      The root cause is in _vm_normal_page, without the PTE_SPECIAL bit,
      the return value will be incorrectly set to pfn_to_page(pfn) instead
      of NULL. Besides, this patch also rewrite the pmd_mkdevmap to avoid
      setting PTE_SPECIAL for pmd
      
      The MAP_SYNC test case is as follows(Provided by Yibo Cai)
      $#include <stdio.h>
      $#include <string.h>
      $#include <unistd.h>
      $#include <sys/file.h>
      $#include <sys/mman.h>
      
      $#ifndef MAP_SYNC
      $#define MAP_SYNC 0x80000
      $#endif
      
      /* mount -o dax /dev/pmem0 /mnt */
      $#define F "/mnt/__aaabbbcccddd__"
      
      int main(void)
      {
          int fd;
          char buf[4096];
          void *addr;
      
          if ((fd = open(F, O_CREAT|O_TRUNC|O_RDWR, 0644)) < 0) {
              perror("open1");
              return 1;
          }
      
          if (write(fd, buf, 4096) != 4096) {
              perror("lseek");
              return 1;
          }
      
          addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_SYNC, fd, 0);
          if (addr == MAP_FAILED) {
              perror("mmap");
              printf("did you mount with '-o dax'?\n");
              return 1;
          }
      
          memset(addr, 0x55, 4096);
      
          if (munmap(addr, 4096) == -1) {
              perror("munmap");
              return 1;
          }
      
          close(fd);
      
          return 0;
      }
      
      Fixes: 73b20c84 ("arm64: mm: implement pte_devmap support")
      Reported-by: default avatarYibo Cai <Yibo.Cai@arm.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Acked-by: default avatarRobin Murphy <Robin.Murphy@arm.com>
      Signed-off-by: default avatarJia He <justin.he@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      30e23538
    • Linus Torvalds's avatar
      Merge tag '5.3-rc3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 518a1c2f
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Six small SMB3 fixes, two for stable"
      
      * tag '5.3-rc3-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        SMB3: Kernel oops mounting a encryptData share with CONFIG_DEBUG_VIRTUAL
        smb3: update TODO list of missing features
        smb3: send CAP_DFS capability during session setup
        SMB3: Fix potential memory leak when processing compound chain
        SMB3: Fix deadlock in validate negotiate hits reconnect
        cifs: fix rmmod regression in cifs.ko caused by force_sig changes
      518a1c2f
    • Mikulas Patocka's avatar
      loop: set PF_MEMALLOC_NOIO for the worker thread · d0a255e7
      Mikulas Patocka authored
      A deadlock with this stacktrace was observed.
      
      The loop thread does a GFP_KERNEL allocation, it calls into dm-bufio
      shrinker and the shrinker depends on I/O completion in the dm-bufio
      subsystem.
      
      In order to fix the deadlock (and other similar ones), we set the flag
      PF_MEMALLOC_NOIO at loop thread entry.
      
      PID: 474    TASK: ffff8813e11f4600  CPU: 10  COMMAND: "kswapd0"
         #0 [ffff8813dedfb938] __schedule at ffffffff8173f405
         #1 [ffff8813dedfb990] schedule at ffffffff8173fa27
         #2 [ffff8813dedfb9b0] schedule_timeout at ffffffff81742fec
         #3 [ffff8813dedfba60] io_schedule_timeout at ffffffff8173f186
         #4 [ffff8813dedfbaa0] bit_wait_io at ffffffff8174034f
         #5 [ffff8813dedfbac0] __wait_on_bit at ffffffff8173fec8
         #6 [ffff8813dedfbb10] out_of_line_wait_on_bit at ffffffff8173ff81
         #7 [ffff8813dedfbb90] __make_buffer_clean at ffffffffa038736f [dm_bufio]
         #8 [ffff8813dedfbbb0] __try_evict_buffer at ffffffffa0387bb8 [dm_bufio]
         #9 [ffff8813dedfbbd0] dm_bufio_shrink_scan at ffffffffa0387cc3 [dm_bufio]
        #10 [ffff8813dedfbc40] shrink_slab at ffffffff811a87ce
        #11 [ffff8813dedfbd30] shrink_zone at ffffffff811ad778
        #12 [ffff8813dedfbdc0] kswapd at ffffffff811ae92f
        #13 [ffff8813dedfbec0] kthread at ffffffff810a8428
        #14 [ffff8813dedfbf50] ret_from_fork at ffffffff81745242
      
        PID: 14127  TASK: ffff881455749c00  CPU: 11  COMMAND: "loop1"
         #0 [ffff88272f5af228] __schedule at ffffffff8173f405
         #1 [ffff88272f5af280] schedule at ffffffff8173fa27
         #2 [ffff88272f5af2a0] schedule_preempt_disabled at ffffffff8173fd5e
         #3 [ffff88272f5af2b0] __mutex_lock_slowpath at ffffffff81741fb5
         #4 [ffff88272f5af330] mutex_lock at ffffffff81742133
         #5 [ffff88272f5af350] dm_bufio_shrink_count at ffffffffa03865f9 [dm_bufio]
         #6 [ffff88272f5af380] shrink_slab at ffffffff811a86bd
         #7 [ffff88272f5af470] shrink_zone at ffffffff811ad778
         #8 [ffff88272f5af500] do_try_to_free_pages at ffffffff811adb34
         #9 [ffff88272f5af590] try_to_free_pages at ffffffff811adef8
        #10 [ffff88272f5af610] __alloc_pages_nodemask at ffffffff811a09c3
        #11 [ffff88272f5af710] alloc_pages_current at ffffffff811e8b71
        #12 [ffff88272f5af760] new_slab at ffffffff811f4523
        #13 [ffff88272f5af7b0] __slab_alloc at ffffffff8173a1b5
        #14 [ffff88272f5af880] kmem_cache_alloc at ffffffff811f484b
        #15 [ffff88272f5af8d0] do_blockdev_direct_IO at ffffffff812535b3
        #16 [ffff88272f5afb00] __blockdev_direct_IO at ffffffff81255dc3
        #17 [ffff88272f5afb30] xfs_vm_direct_IO at ffffffffa01fe3fc [xfs]
        #18 [ffff88272f5afb90] generic_file_read_iter at ffffffff81198994
        #19 [ffff88272f5afc50] __dta_xfs_file_read_iter_2398 at ffffffffa020c970 [xfs]
        #20 [ffff88272f5afcc0] lo_rw_aio at ffffffffa0377042 [loop]
        #21 [ffff88272f5afd70] loop_queue_work at ffffffffa0377c3b [loop]
        #22 [ffff88272f5afe60] kthread_worker_fn at ffffffff810a8a0c
        #23 [ffff88272f5afec0] kthread at ffffffff810a8428
        #24 [ffff88272f5aff50] ret_from_fork at ffffffff81745242
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      d0a255e7
    • Jan Kara's avatar
      bdev: Fixup error handling in blkdev_get() · e91455ba
      Jan Kara authored
      Commit 89e524c0 ("loop: Fix mount(2) failure due to race with
      LOOP_SET_FD") converted blkdev_get() to use the new helpers for
      finishing claiming of a block device. However the conversion botched the
      error handling in blkdev_get() and thus the bdev has been marked as held
      even in case __blkdev_get() returned error. This led to occasional
      warnings with block/001 test from blktests like:
      
      kernel: WARNING: CPU: 5 PID: 907 at fs/block_dev.c:1899 __blkdev_put+0x396/0x3a0
      
      Correct the error handling.
      
      CC: stable@vger.kernel.org
      Fixes: 89e524c0 ("loop: Fix mount(2) failure due to race with LOOP_SET_FD")
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e91455ba
    • Paolo Valente's avatar
      block, bfq: handle NULL return value by bfq_init_rq() · fd03177c
      Paolo Valente authored
      As reported in [1], the call bfq_init_rq(rq) may return NULL in case
      of OOM (in particular, if rq->elv.icq is NULL because memory
      allocation failed in failed in ioc_create_icq()).
      
      This commit handles this circumstance.
      
      [1] https://lkml.org/lkml/2019/7/22/824
      
      Cc: Hsin-Yi Wang <hsinyi@google.com>
      Cc: Nicolas Boichat <drinkcat@chromium.org>
      Cc: Doug Anderson <dianders@chromium.org>
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reported-by: default avatarHsin-Yi Wang <hsinyi@google.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarPaolo Valente <paolo.valente@linaro.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      fd03177c
    • Paolo Valente's avatar
      block, bfq: move update of waker and woken list to queue freeing · 3f758e84
      Paolo Valente authored
      Since commit 13a857a4 ("block, bfq: detect wakers and
      unconditionally inject their I/O"), every bfq_queue has a pointer to a
      waker bfq_queue and a list of the bfq_queues it may wake. In this
      respect, when a bfq_queue, say Q, remains with no I/O source attached
      to it, Q cannot be woken by any other bfq_queue, and cannot wake any
      other bfq_queue. Then Q must be removed from the woken list of its
      possible waker bfq_queue, and all bfq_queues in the woken list of Q
      must stop having a waker bfq_queue.
      
      Q remains with no I/O source in two cases: when the last process
      associated with Q exits or when such a process gets associated with a
      different bfq_queue. Unfortunately, commit 13a857a4 ("block, bfq:
      detect wakers and unconditionally inject their I/O") performed the
      above updates only in the first case.
      
      This commit fixes this bug by moving these updates to when Q gets
      freed. This is a simple and safe way to handle all cases, as both the
      above events, process exit and re-association, lead to Q being freed
      soon, and because dangling references would come out only after Q gets
      freed (if no update were performed).
      
      Fixes: 13a857a4 ("block, bfq: detect wakers and unconditionally inject their I/O")
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarPaolo Valente <paolo.valente@linaro.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      3f758e84
    • Paolo Valente's avatar
      block, bfq: reset last_completed_rq_bfqq if the pointed queue is freed · 08d383a7
      Paolo Valente authored
      Since commit 13a857a4 ("block, bfq: detect wakers and
      unconditionally inject their I/O"), BFQ stores, in a per-device
      pointer last_completed_rq_bfqq, the last bfq_queue that had an I/O
      request completed. If some bfq_queue receives new I/O right after the
      last request of last_completed_rq_bfqq has been completed, then
      last_completed_rq_bfqq may be a waker bfq_queue.
      
      But if the bfq_queue last_completed_rq_bfqq points to is freed, then
      last_completed_rq_bfqq becomes a dangling reference. This commit
      resets last_completed_rq_bfqq if the pointed bfq_queue is freed.
      
      Fixes: 13a857a4 ("block, bfq: detect wakers and unconditionally inject their I/O")
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarPaolo Valente <paolo.valente@linaro.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      08d383a7
    • He Zhe's avatar
      block: aoe: Fix kernel crash due to atomic sleep when exiting · 430380b4
      He Zhe authored
      Since commit 3582dd29 ("aoe: convert aoeblk to blk-mq"), aoedev_downdev
      has had the possibility of sleeping and causing the following crash.
      
      BUG: scheduling while atomic: rmmod/2242/0x00000003
      Modules linked in: aoe
      Preemption disabled at:
      [<ffffffffc01d95e5>] flush+0x95/0x4a0 [aoe]
      CPU: 7 PID: 2242 Comm: rmmod Tainted: G          I       5.2.3 #1
      Hardware name: Intel Corporation S5520HC/S5520HC, BIOS S5500.86B.01.10.0025.030220091519 03/02/2009
      Call Trace:
       dump_stack+0x4f/0x6a
       ? flush+0x95/0x4a0 [aoe]
       __schedule_bug.cold+0x44/0x54
       __schedule+0x44f/0x680
       schedule+0x44/0xd0
       blk_mq_freeze_queue_wait+0x46/0xb0
       ? wait_woken+0x80/0x80
       blk_mq_freeze_queue+0x1b/0x20
       aoedev_downdev+0x111/0x160 [aoe]
       flush+0xff/0x4a0 [aoe]
       aoedev_exit+0x23/0x30 [aoe]
       aoe_exit+0x35/0x948 [aoe]
       __se_sys_delete_module+0x183/0x210
       __x64_sys_delete_module+0x16/0x20
       do_syscall_64+0x4d/0x130
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x7f24e0043b07
      Code: 73 01 c3 48 8b 0d 89 73 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f
      1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff
      ff 73 01 c3 48 8b 0d 59 73 0b 00 f7 d8 64 89 01 48
      RSP: 002b:00007ffe18f7f1e8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f24e0043b07
      RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000555c3ecf87c8
      RBP: 00007ffe18f7f1f0 R08: 0000000000000000 R09: 0000000000000000
      R10: 00007f24e00b4ac0 R11: 0000000000000206 R12: 00007ffe18f7f238
      R13: 00007ffe18f7f410 R14: 00007ffe18f80e73 R15: 0000555c3ecf8760
      
      This patch, handling in the same way of pass two, unlocks the locks and
      restart pass one after aoedev_downdev is done.
      
      Fixes: 3582dd29 ("aoe: convert aoeblk to blk-mq")
      Signed-off-by: default avatarHe Zhe <zhe.he@windriver.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      430380b4
    • Vasily Gorbik's avatar
      s390/build: use size command to perform empty .bss check · 739bacbf
      Vasily Gorbik authored
      Currently empty .bss checks performed do not pay attention to "common
      objects" in object files which end up in .bss section eventually.
      
      The "size" tool is a part of binutils and since version 2.18 provides
      "--common" command line option, which allows to account "common objects"
      sizes in .bss section size. Utilize "size --common" to perform accurate
      check that .bss section is unused. Besides that the size tool handles
      object files without .bss section gracefully and doesn't require
      additional objdump run.
      
      The linux kernel requires binutils 2.20 since 4.13.
      
      Kbuild exports OBJSIZE to reference the right size tool.
      
      Link: http://lkml.kernel.org/r/patch-2.thread-2257a1.git-2257a1c53d4a.your-ad-here.call-01565088755-ext-5120@work.hoursReported-and-tested-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Acked-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      739bacbf
    • Vasily Gorbik's avatar
      kbuild: add OBJSIZE variable for the size tool · 7bac9870
      Vasily Gorbik authored
      Define and export OBJSIZE variable for "size" tool from binutils to be
      used in architecture specific Makefiles (naming the variable just "SIZE"
      would be too risky). In particular this tool is useful to perform checks
      that early boot code is not using bss section (which might have not been
      zeroed yet or intersects with initrd or other files boot loader might
      have put right after the linux kernel).
      
      Link: http://lkml.kernel.org/r/patch-1.thread-2257a1.git-188f5a3d81d5.your-ad-here.call-01565088755-ext-5120@work.hoursAcked-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      7bac9870
    • Hans de Goede's avatar
      pwm: Fallback to the static lookup-list when acpi_pwm_get fails · 6cf9481b
      Hans de Goede authored
      Commit 4a6ef8e3 ("pwm: Add support referencing PWMs from ACPI")
      made pwm_get unconditionally return the acpi_pwm_get return value if
      the device passed to pwm_get has an ACPI fwnode.
      
      But even if the passed in device has an ACPI fwnode, it does not
      necessarily have the necessary ACPI package defining its pwm bindings,
      especially since the binding / API of this ACPI package has only been
      introduced very recently.
      
      Up until now X86/ACPI devices which use a separate pwm controller for
      controlling their LCD screen's backlight brightness have been relying
      on the static lookup-list to get their pwm.
      
      pwm_get unconditionally returning the acpi_pwm_get return value breaks
      this, breaking backlight control on these devices.
      
      This commit fixes this by making pwm_get fall back to the static
      lookup-list if acpi_pwm_get returns -ENOENT.
      
      BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=96571
      Reported-by: youling257@gmail.com
      Fixes: 4a6ef8e3 ("pwm: Add support referencing PWMs from ACPI")
      Cc: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarNikolaus Voss <nikolaus.voss@loewensteinmedical.de>
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      6cf9481b
    • Colin Ian King's avatar
      drm/vmwgfx: fix memory leak when too many retries have occurred · 6b7c3b86
      Colin Ian King authored
      Currently when too many retries have occurred there is a memory
      leak on the allocation for reply on the error return path. Fix
      this by kfree'ing reply before returning.
      
      Addresses-Coverity: ("Resource leak")
      Fixes: a9cd9c04 ("drm/vmwgfx: Add a check to handle host message failure")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Reviewed-by: default avatarDeepak Rawat <drawat@vmware.com>
      Signed-off-by: default avatarDeepak Rawat <drawat@vmware.com>
      Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
      6b7c3b86
    • Wenwen Wang's avatar
      ALSA: firewire: fix a memory leak bug · 1be3c1fa
      Wenwen Wang authored
      In iso_packets_buffer_init(), 'b->packets' is allocated through
      kmalloc_array(). Then, the aligned packet size is checked. If it is
      larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
      However, the allocated 'b->packets' is not deallocated on this path,
      leading to a memory leak.
      
      To fix the above issue, free 'b->packets' before returning the error code.
      
      Fixes: 31ef9134 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # v2.6.39+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1be3c1fa
    • Wenwen Wang's avatar
      sound: fix a memory leak bug · c7cd7c74
      Wenwen Wang authored
      In sound_insert_unit(), the controlling structure 's' is allocated through
      kmalloc(). Then it is added to the sound driver list by invoking
      __sound_insert_unit(). Later on, if __register_chrdev() fails, 's' is
      removed from the list through __sound_remove_unit(). If 'index' is not less
      than 0, -EBUSY is returned to indicate the error. However, 's' is not
      deallocated on this execution path, leading to a memory leak bug.
      
      To fix the above issue, free 's' before -EBUSY is returned.
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c7cd7c74
    • Dave Airlie's avatar
      Merge tag 'drm-fixes-5.3-2019-08-07' of git://people.freedesktop.org/~agd5f/linux into drm-fixes · f536579c
      Dave Airlie authored
      drm-fixes-5.3-2019-08-07:
      
      amdgpu:
      - Fixes VCN to handle the latest navi10 firmware
      - Fixes for fan control on navi10
      - Properly handle SMU metrics table on navi10
      - Fix a resume regression on Stoney
      
      amdkfd:
      - Revert new GWS ioctl.  It's not ready.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexdeucher@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190807184221.3323-1-alexander.deucher@amd.com
      f536579c
    • Dave Airlie's avatar
      Merge tag 'drm/tegra/for-5.3-rc4' of git://anongit.freedesktop.org/tegra/linux into drm-fixes · abffedaa
      Dave Airlie authored
      drm/tegra: Fixes for v5.3-rc4
      
      This contains a single fix for a regression introduced by a combination
      of a GPIO and a drm/tegra patch merged in v5.3-rc1.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Thierry Reding <thierry.reding@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190807140634.29166-1-thierry.reding@gmail.com
      abffedaa
  3. 07 Aug, 2019 6 commits
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.3-rc4' of... · ecb095bf
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
       "Fixes to lm75 and nct7802 drivers
      
        In the lm75 driver, fix TMP75B chip description to ensure correct
        initialization. In the nct7802 driver, fix in4 presence detection"
      
      * tag 'hwmon-for-v5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (lm75) Fixup tmp75b clr_mask
        hwmon: (nct7802) Fix wrong detection of in4 presence
      ecb095bf
    • Iker Perez del Palomar Sustatxa's avatar
      hwmon: (lm75) Fixup tmp75b clr_mask · a95a4f3f
      Iker Perez del Palomar Sustatxa authored
      The configuration register of the tmp75b sensor is 16bit long, however
      the first byte is reserved, so there is not no need to take care of it.
      
      Because the order of the bytes is little endian and it is only necessary
      to write one byte, the desired bits must be shifted into a 8 bit range.
      
      Fixes: 39abe9d8 ("hwmon: (lm75) Add support for TMP75B")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarIker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
      Link: https://lore.kernel.org/r/20190801075324.4638-1-iker.perez@codethink.co.ukSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      a95a4f3f
    • Guenter Roeck's avatar
      hwmon: (nct7802) Fix wrong detection of in4 presence · 38ada2f4
      Guenter Roeck authored
      The code to detect if in4 is present is wrong; if in4 is not present,
      the in4_input sysfs attribute is still present.
      
      In detail:
      
      - Ihen RTD3_MD=11 (VSEN3 present), everything is as expected (no bug).
      - If we have RTD3_MD!=11 (no VSEN3), we unexpectedly have a in4_input
        file under /sys and the "sensors" command displays in4_input.
        But as expected, we have no in4_min, in4_max, in4_alarm, in4_beep.
      
      Fix is_visible function to detect and report in4_input visibility
      as expected.
      Reported-by: default avatarGilles Buloz <Gilles.Buloz@kontron.com>
      Cc: Gilles Buloz <Gilles.Buloz@kontron.com>
      Cc: stable@vger.kernel.org
      Fixes: 3434f378 ("hwmon: Driver for Nuvoton NCT7802Y")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      38ada2f4
    • Jens Axboe's avatar
      libata: add SG safety checks in SFF pio transfers · 752ead44
      Jens Axboe authored
      Abort processing of a command if we run out of mapped data in the
      SG list. This should never happen, but a previous bug caused it to
      be possible. Play it safe and attempt to abort nicely if we don't
      have more SG segments left.
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      752ead44
    • Jens Axboe's avatar
      libata: have ata_scsi_rw_xlat() fail invalid passthrough requests · 2d727150
      Jens Axboe authored
      For passthrough requests, libata-scsi takes what the user passes in
      as gospel. This can be problematic if the user fills in the CDB
      incorrectly. One example of that is in request sizes. For read/write
      commands, the CDB contains fields describing the transfer length of
      the request. These should match with the SG_IO header fields, but
      libata-scsi currently does no validation of that.
      
      Check that the number of blocks in the CDB for passthrough requests
      matches what was mapped into the request. If the CDB asks for more
      data then the validated SG_IO header fields, error it.
      Reported-by: default avatarKrishna Ram Prakash R <krp@gtux.in>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      2d727150
    • Jens Axboe's avatar
      block: fix O_DIRECT error handling for bio fragments · e15c2ffa
      Jens Axboe authored
      0eb6ddfb tried to fix this up, but introduced a use-after-free
      of dio. Additionally, we still had an issue with error handling,
      as reported by Darrick:
      
      "I noticed a regression in xfs/747 (an unreleased xfstest for the
      xfs_scrub media scanning feature) on 5.3-rc3.  I'll condense that down
      to a simpler reproducer:
      
      error-test: 0 209 linear 8:48 0
      error-test: 209 1 error
      error-test: 210 6446894 linear 8:48 210
      
      Basically we have a ~3G /dev/sdd and we set up device mapper to fail IO
      for sector 209 and to pass the io to the scsi device everywhere else.
      
      On 5.3-rc3, performing a directio pread of this range with a < 1M buffer
      (in other words, a request for fewer than MAX_BIO_PAGES bytes) yields
      EIO like you'd expect:
      
      pread64(3, 0x7f880e1c7000, 1048576, 0)  = -1 EIO (Input/output error)
      pread: Input/output error
      +++ exited with 0 +++
      
      But doing it with a larger buffer succeeds(!):
      
      pread64(3, "XFSB\0\0\20\0\0\0\0\0\0\fL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1146880, 0) = 1146880
      read 1146880/1146880 bytes at offset 0
      1 MiB, 1 ops; 0.0009 sec (1.124 GiB/sec and 1052.6316 ops/sec)
      +++ exited with 0 +++
      
      (Note that the part of the buffer corresponding to the dm-error area is
      uninitialized)
      
      On 5.3-rc2, both commands would fail with EIO like you'd expect.  The
      only change between rc2 and rc3 is commit 0eb6ddfb ("block: Fix
      __blkdev_direct_IO() for bio fragments").
      
      AFAICT we end up in __blkdev_direct_IO with a 1120K buffer, which gets
      split into two bios: one for the first BIO_MAX_PAGES worth of data (1MB)
      and a second one for the 96k after that."
      
      Fix this by noting that it's always safe to dereference dio if we get
      BLK_QC_T_EAGAIN returned, as end_io hasn't been run for that case. So
      we can safely increment the dio size before calling submit_bio(), and
      then decrement it on failure (not that it really matters, as the bio
      and dio are going away).
      
      For error handling, return to the original method of just using 'ret'
      for tracking the error, and the size tracking in dio->size.
      
      Fixes: 0eb6ddfb ("block: Fix __blkdev_direct_IO() for bio fragments")
      Fixes: 6a43074e ("block: properly handle IOCB_NOWAIT for async O_DIRECT IO")
      Reported-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e15c2ffa