1. 27 11月, 2018 9 次提交
    • H
      net: hns3: bugfix for the initialization of command queue's spin lock · 91a52a44
      Huazhong Tan 提交于
      [ Upstream commit b2f74dbaf12bf59ff35d451005b3cdee78232ff0 ]
      
      The spin lock of the command queue only need to be initialized once
      when the driver initializes the command queue. It is not necessary to
      initialize the spin lock when resetting. At the same time, the
      modification of the queue member should be performed after acquiring
      the lock.
      
      Fixes: 3efb960f ("net: hns3: Refactor the initialization of command queue")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      91a52a44
    • H
      net: hns3: bugfix for handling mailbox while the command queue reinitialized · 355ec075
      Huazhong Tan 提交于
      [ Upstream commit 3c88ed1d ]
      
      In a multi-core machine, the mailbox service and reset service
      will be executed at the same time. The reset service will re-initialize
      the command queue, before that, the mailbox handler can only get some
      invalid messages.
      
      The HCLGE_STATE_CMD_DISABLE flag means that the command queue is not
      available and needs to be reinitialized. Therefore, when the mailbox
      handler recognizes this flag, it should not process the command.
      
      Fixes: dde1a86e ("net: hns3: Add mailbox support to PF driver")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      355ec075
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclge_reset() · 92cb1b09
      Huazhong Tan 提交于
      [ Upstream commit a963052e ]
      
      Since hclge_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclge_reset_wait(). So this patch releases the lock for the duration
      of hclge_reset_wait().
      
      Fixes: 6d4fab39 ("net: hns3: Reset net device with rtnl_lock")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      92cb1b09
    • H
      net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset() · 733edfd6
      Huazhong Tan 提交于
      [ Upstream commit 29118ab962d5476fdc65fae312ac38db68092d78 ]
      
      Since hclgevf_reset_wait() is used to wait for the hardware to complete
      the reset, it is not necessary to hold the rtnl_lock during
      hclgevf_reset_wait(). So this patch releases the lock for the duration
      of hclgevf_reset_wait().
      
      Fixes: 6988eb2a ("net: hns3: Add support to reset the enet/ring mgmt layer")
      Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      733edfd6
    • M
      block: brd: associate with queue until adding disk · 0987d5a6
      Ming Lei 提交于
      [ Upstream commit 153fcd5f ]
      
      brd_free() may be called in failure path on one brd instance which
      disk isn't added yet, so release handler of gendisk may free the
      associated request_queue early and causes the following use-after-free[1].
      
      This patch fixes this issue by associating gendisk with request_queue
      just before adding disk.
      
      [1] KASAN: use-after-free Read in del_timer_syncNon-volatile memory driver v1.3
      Linux agpgart interface v0.103
      [drm] Initialized vgem 1.0.0 20120112 for virtual device on minor 0
      usbcore: registered new interface driver udl
      ==================================================================
      BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20
      kernel/locking/lockdep.c:3218
      Read of size 8 at addr ffff8801d1b6b540 by task swapper/0/1
      
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0+ #88
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      Call Trace:
        __dump_stack lib/dump_stack.c:77 [inline]
        dump_stack+0x244/0x39d lib/dump_stack.c:113
        print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256
        kasan_report_error mm/kasan/report.c:354 [inline]
        kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412
        __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
        __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218
        lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
        del_timer_sync+0xb7/0x270 kernel/time/timer.c:1283
        blk_cleanup_queue+0x413/0x710 block/blk-core.c:809
        brd_free+0x5d/0x71 drivers/block/brd.c:422
        brd_init+0x2eb/0x393 drivers/block/brd.c:518
        do_one_initcall+0x145/0x957 init/main.c:890
        do_initcall_level init/main.c:958 [inline]
        do_initcalls init/main.c:966 [inline]
        do_basic_setup init/main.c:984 [inline]
        kernel_init_freeable+0x5c6/0x6b9 init/main.c:1148
        kernel_init+0x11/0x1ae init/main.c:1068
        ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:350
      
      Reported-by: syzbot+3701447012fe951dabb2@syzkaller.appspotmail.com
      Signed-off-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0987d5a6
    • A
      arm64: kprobe: make page to RO mode when allocate it · 262522cc
      Anders Roxell 提交于
      [ Upstream commit 966866892cf89d606544bca22d584ba2ef9ec208 ]
      
      Commit 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
      has successfully identified code that leaves a page with W+X
      permissions.
      
      [    3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000
      [    3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420
      [    3.246141] Modules linked in:
      [    3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62
      [    3.247008] Hardware name: linux,dummy-virt (DT)
      [    3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO)
      [    3.247623] pc : note_page+0x410/0x420
      [    3.247898] lr : note_page+0x410/0x420
      [    3.248071] sp : ffff00000804bcd0
      [    3.248254] x29: ffff00000804bcd0 x28: ffff000009274000
      [    3.248578] x27: ffff00000921a000 x26: ffff80007dfff000
      [    3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a
      [    3.249109] x23: 0000000000000004 x22: ffff000000d91000
      [    3.249396] x21: ffff000000d90000 x20: 0000000000000000
      [    3.249661] x19: ffff00000804bde8 x18: 0000000000000400
      [    3.249924] x17: 0000000000000000 x16: 0000000000000000
      [    3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176
      [    3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461
      [    3.250941] x11: 20746120676e6970 x10: 70616d20582b5720
      [    3.251252] x9 : 6572756365736e69 x8 : 3039643030303030
      [    3.251519] x7 : 306666666678302f x6 : ffff0000095467b2
      [    3.251802] x5 : 0000000000000000 x4 : 0000000000000000
      [    3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff
      [    3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000
      [    3.252664] Call trace:
      [    3.252953]  note_page+0x410/0x420
      [    3.253186]  walk_pgd+0x12c/0x238
      [    3.253417]  ptdump_check_wx+0x68/0xf8
      [    3.253637]  mark_rodata_ro+0x68/0x98
      [    3.253847]  kernel_init+0x38/0x160
      [    3.254103]  ret_from_fork+0x10/0x18
      
      kprobes allocates a writable executable page with module_alloc() in
      order to store executable code.
      Reworked to that when allocate a page it sets mode RO. Inspired by
      commit 63fef14f ("kprobes/x86: Make insn buffer always ROX and use text_poke()").
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NLaura Abbott <labbott@redhat.com>
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      [catalin.marinas@arm.com: removed unnecessary casts]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      262522cc
    • R
      cifs: fix return value for cifs_listxattr · e4ed4e68
      Ronnie Sahlberg 提交于
      [ Upstream commit 0c5d6cb6643f48ad3775322f3ebab6c7eb67484e ]
      
      If the application buffer was too small to fit all the names
      we would still count the number of bytes and return this for
      listxattr. This would then trigger a BUG in usercopy.c
      
      Fix the computation of the size so that we return -ERANGE
      correctly when the buffer is too small.
      
      This fixes the kernel BUG for xfstest generic/377
      Signed-off-by: NRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Reviewed-by: NAurelien Aptel <aaptel@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e4ed4e68
    • C
      cifs: don't dereference smb_file_target before null check · ad1834fd
      Colin Ian King 提交于
      [ Upstream commit 8c6c9bed8773375b1d54ccca2911ec892c59db5d ]
      
      There is a null check on dst_file->private data which suggests
      it can be potentially null. However, before this check, pointer
      smb_file_target is derived from dst_file->private and dereferenced
      in the call to tlink_tcon, hence there is a potential null pointer
      deference.
      
      Fix this by assigning smb_file_target and target_tcon after the
      null pointer sanity checks.
      
      Detected by CoverityScan, CID#1475302 ("Dereference before null check")
      
      Fixes: 04b38d60 ("vfs: pull btrfs clone API to vfs layer")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NSteve French <stfrench@microsoft.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ad1834fd
    • V
      drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE · 1beb22c5
      Ville Syrjälä 提交于
      commit f6e35cda upstream.
      
      Use I915_GTT_PAGE_SIZE when talking about GTT pages rather than
      physical pages.
      
      There are some PAGE_SHIFTs left though. Not sure if we want to
      introduce I915_GTT_PAGE_SHIFT or what?
      
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> # at least some of it :)
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180913150405.706-1-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1beb22c5
  2. 23 11月, 2018 31 次提交