1. 02 May, 2020 8 commits
    • James Smart's avatar
      scsi: lpfc: Fix kasan slab-out-of-bounds error in lpfc_unreg_login · f5fce916
      James Smart authored
      [ Upstream commit 38503943 ]
      
      The following kasan bug was called out:
      
       BUG: KASAN: slab-out-of-bounds in lpfc_unreg_login+0x7c/0xc0 [lpfc]
       Read of size 2 at addr ffff889fc7c50a22 by task lpfc_worker_3/6676
       ...
       Call Trace:
       dump_stack+0x96/0xe0
       ? lpfc_unreg_login+0x7c/0xc0 [lpfc]
       print_address_description.constprop.6+0x1b/0x220
       ? lpfc_unreg_login+0x7c/0xc0 [lpfc]
       ? lpfc_unreg_login+0x7c/0xc0 [lpfc]
       __kasan_report.cold.9+0x37/0x7c
       ? lpfc_unreg_login+0x7c/0xc0 [lpfc]
       kasan_report+0xe/0x20
       lpfc_unreg_login+0x7c/0xc0 [lpfc]
       lpfc_sli_def_mbox_cmpl+0x334/0x430 [lpfc]
       ...
      
      When processing the completion of a "Reg Rpi" login mailbox command in
      lpfc_sli_def_mbox_cmpl, a call may be made to lpfc_unreg_login. The vpi is
      extracted from the completing mailbox context and passed as an input for
      the next. However, the vpi stored in the mailbox command context is an
      absolute vpi, which for SLI4 represents both base + offset.  When used with
      a non-zero base component, (function id > 0) this results in an
      out-of-range access beyond the allocated phba->vpi_ids array.
      
      Fix by subtracting the function's base value to get an accurate vpi number.
      
      Link: https://lore.kernel.org/r/20200322181304.37655-2-jsmart2021@gmail.comSigned-off-by: default avatarJames Smart <jsmart2021@gmail.com>
      Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f5fce916
    • Tero Kristo's avatar
      watchdog: reset last_hw_keepalive time at start · 21abb350
      Tero Kristo authored
      [ Upstream commit 982bb705 ]
      
      Currently the watchdog core does not initialize the last_hw_keepalive
      time during watchdog startup. This will cause the watchdog to be pinged
      immediately if enough time has passed from the system boot-up time, and
      some types of watchdogs like K3 RTI does not like this.
      
      To avoid the issue, setup the last_hw_keepalive time during watchdog
      startup.
      Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20200302200426.6492-3-t-kristo@ti.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      21abb350
    • Jeremy Sowden's avatar
      vti4: removed duplicate log message. · 1dd76d05
      Jeremy Sowden authored
      commit 01ce31c5 upstream.
      
      Removed info log-message if ipip tunnel registration fails during
      module-initialization: it adds nothing to the error message that is
      written on all failures.
      
      Fixes: dd9ee344 ("vti4: Fix a ipip packet processing bug in 'IPCOMP' virtual tunnel")
      Signed-off-by: default avatarJeremy Sowden <jeremy@azazel.net>
      Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1dd76d05
    • Wei Yongjun's avatar
      crypto: mxs-dcp - make symbols 'sha1_null_hash' and 'sha256_null_hash' static · 32b13c52
      Wei Yongjun authored
      commit ce4e4584 upstream.
      
      Fixes the following sparse warnings:
      
      drivers/crypto/mxs-dcp.c:39:15: warning:
       symbol 'sha1_null_hash' was not declared. Should it be static?
      drivers/crypto/mxs-dcp.c:43:15: warning:
       symbol 'sha256_null_hash' was not declared. Should it be static?
      
      Fixes: c709eeba ("crypto: mxs-dcp - Fix SHA null hashes and output length")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32b13c52
    • Rob Clark's avatar
      drm/msm: Use the correct dma_sync calls harder · dca9d4ec
      Rob Clark authored
      commit 9f614197 upstream.
      
      Looks like the dma_sync calls don't do what we want on armv7 either.
      Fixes:
      
        Unable to handle kernel paging request at virtual address 50001000
        pgd = (ptrval)
        [50001000] *pgd=00000000
        Internal error: Oops: 805 [#1] SMP ARM
        Modules linked in:
        CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc6-00271-g9f159ae0 #4
        Hardware name: Freescale i.MX53 (Device Tree Support)
        PC is at v7_dma_clean_range+0x20/0x38
        LR is at __dma_page_cpu_to_dev+0x28/0x90
        pc : [<c011c76c>]    lr : [<c01181c4>]    psr: 20000013
        sp : d80b5a88  ip : de96c000  fp : d840ce6c
        r10: 00000000  r9 : 00000001  r8 : d843e010
        r7 : 00000000  r6 : 00008000  r5 : ddb6c000  r4 : 00000000
        r3 : 0000003f  r2 : 00000040  r1 : 50008000  r0 : 50001000
        Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
        Control: 10c5387d  Table: 70004019  DAC: 00000051
        Process swapper/0 (pid: 1, stack limit = 0x(ptrval))
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Fixes: 3de433c5 ("drm/msm: Use the correct dma_sync calls in msm_gem")
      Tested-by: default avatarFabio Estevam <festevam@gmail.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dca9d4ec
    • Arnd Bergmann's avatar
      net: ipv4: avoid unused variable warning for sysctl · bcdb7d9e
      Arnd Bergmann authored
      commit 773daa3c upstream.
      
      The newly introudced ip_min_valid_pmtu variable is only used when
      CONFIG_SYSCTL is set:
      
      net/ipv4/route.c:135:12: error: 'ip_min_valid_pmtu' defined but not used [-Werror=unused-variable]
      
      This moves it to the other variables like it, to avoid the harmless
      warning.
      
      Fixes: c7272c2f ("net: ipv4: don't allow setting net.ipv4.route.min_pmtu below 68")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bcdb7d9e
    • Nicolai Stange's avatar
      net: ipv4: emulate READ_ONCE() on ->hdrincl bit-field in raw_sendmsg() · 56560002
      Nicolai Stange authored
      commit 20b50d79 upstream.
      
      Commit 8f659a03 ("net: ipv4: fix for a race condition in
      raw_sendmsg") fixed the issue of possibly inconsistent ->hdrincl handling
      due to concurrent updates by reading this bit-field member into a local
      variable and using the thus stabilized value in subsequent tests.
      
      However, aforementioned commit also adds the (correct) comment that
      
        /* hdrincl should be READ_ONCE(inet->hdrincl)
         * but READ_ONCE() doesn't work with bit fields
         */
      
      because as it stands, the compiler is free to shortcut or even eliminate
      the local variable at its will.
      
      Note that I have not seen anything like this happening in reality and thus,
      the concern is a theoretical one.
      
      However, in order to be on the safe side, emulate a READ_ONCE() on the
      bit-field by doing it on the local 'hdrincl' variable itself:
      
      	int hdrincl = inet->hdrincl;
      	hdrincl = READ_ONCE(hdrincl);
      
      This breaks the chain in the sense that the compiler is not allowed
      to replace subsequent reads from hdrincl with reloads from inet->hdrincl.
      
      Fixes: 8f659a03 ("net: ipv4: fix for a race condition in raw_sendmsg")
      Signed-off-by: default avatarNicolai Stange <nstange@suse.de>
      Reviewed-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56560002
    • Dmitry Monakhov's avatar
      ext4: fix extent_status fragmentation for plain files · 6f362a43
      Dmitry Monakhov authored
      commit 4068664e upstream.
      
      Extents are cached in read_extent_tree_block(); as a result, extents
      are not cached for inodes with depth == 0 when we try to find the
      extent using ext4_find_extent().  The result of the lookup is cached
      in ext4_map_blocks() but is only a subset of the extent on disk.  As a
      result, the contents of extents status cache can get very badly
      fragmented for certain workloads, such as a random 4k read workload.
      
      File size of /mnt/test is 33554432 (8192 blocks of 4096 bytes)
       ext:     logical_offset:        physical_offset: length:   expected: flags:
         0:        0..    8191:      40960..     49151:   8192:             last,eof
      
      $ perf record -e 'ext4:ext4_es_*' /root/bin/fio --name=t --direct=0 --rw=randread --bs=4k --filesize=32M --size=32M --filename=/mnt/test
      $ perf script | grep ext4_es_insert_extent | head -n 10
                   fio   131 [000]    13.975421:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [494/1) mapped 41454 status W
                   fio   131 [000]    13.975939:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6064/1) mapped 47024 status W
                   fio   131 [000]    13.976467:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6907/1) mapped 47867 status W
                   fio   131 [000]    13.976937:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3850/1) mapped 44810 status W
                   fio   131 [000]    13.977440:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3292/1) mapped 44252 status W
                   fio   131 [000]    13.977931:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6882/1) mapped 47842 status W
                   fio   131 [000]    13.978376:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3117/1) mapped 44077 status W
                   fio   131 [000]    13.978957:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [2896/1) mapped 43856 status W
                   fio   131 [000]    13.979474:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [7479/1) mapped 48439 status W
      
      Fix this by caching the extents for inodes with depth == 0 in
      ext4_find_extent().
      
      [ Renamed ext4_es_cache_extents() to ext4_cache_extents() since this
        newly added function is not in extents_cache.c, and to avoid
        potential visual confusion with ext4_es_cache_extent().  -TYT ]
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@gmail.com>
      Link: https://lore.kernel.org/r/20191106122502.19986-1-dmonakhov@gmail.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f362a43
  2. 24 Apr, 2020 32 commits