1. 13 Oct, 2018 22 commits
  2. 10 Oct, 2018 18 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.75 · 8e6a9240
      Greg Kroah-Hartman authored
      8e6a9240
    • Mike Snitzer's avatar
      dm thin metadata: fix __udivdi3 undefined on 32-bit · 4e7ea651
      Mike Snitzer authored
      commit 013ad043 upstream.
      
      sector_div() is only viable for use with sector_t.
      dm_block_t is typedef'd to uint64_t -- so use div_u64() instead.
      
      Fixes: 3ab91828 ("dm thin metadata: try to avoid ever aborting transactions")
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e7ea651
    • Song Liu's avatar
      ixgbe: check return value of napi_complete_done() · 07f79b39
      Song Liu authored
      commit 4233cfe6 upstream.
      
      The NIC driver should only enable interrupts when napi_complete_done()
      returns true. This patch adds the check for ixgbe.
      
      Cc: stable@vger.kernel.org # 4.10+
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      07f79b39
    • Ashish Samant's avatar
      ocfs2: fix locking for res->tracking and dlm->tracking_list · de0e2a92
      Ashish Samant authored
      commit cbe355f5 upstream.
      
      In dlm_init_lockres() we access and modify res->tracking and
      dlm->tracking_list without holding dlm->track_lock.  This can cause list
      corruptions and can end up in kernel panic.
      
      Fix this by locking res->tracking and dlm->tracking_list with
      dlm->track_lock instead of dlm->spinlock.
      
      Link: http://lkml.kernel.org/r/1529951192-4686-1-git-send-email-ashish.samant@oracle.comSigned-off-by: default avatarAshish Samant <ashish.samant@oracle.com>
      Reviewed-by: default avatarChangwei Ge <ge.changwei@h3c.com>
      Acked-by: default avatarJoseph Qi <jiangqi903@gmail.com>
      Acked-by: default avatarJun Piao <piaojun@huawei.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <ge.changwei@h3c.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      de0e2a92
    • Jann Horn's avatar
      proc: restrict kernel stack dumps to root · f8566a92
      Jann Horn authored
      commit f8a00cef upstream.
      
      Currently, you can use /proc/self/task/*/stack to cause a stack walk on
      a task you control while it is running on another CPU.  That means that
      the stack can change under the stack walker.  The stack walker does
      have guards against going completely off the rails and into random
      kernel memory, but it can interpret random data from your kernel stack
      as instruction pointers and stack pointers.  This can cause exposure of
      kernel stack contents to userspace.
      
      Restrict the ability to inspect kernel stacks of arbitrary tasks to root
      in order to prevent a local attacker from exploiting racy stack unwinding
      to leak kernel task stack contents.  See the added comment for a longer
      rationale.
      
      There don't seem to be any users of this userspace API that can't
      gracefully bail out if reading from the file fails.  Therefore, I believe
      that this change is unlikely to break things.  In the case that this patch
      does end up needing a revert, the next-best solution might be to fake a
      single-entry stack based on wchan.
      
      Link: http://lkml.kernel.org/r/20180927153316.200286-1-jannh@google.com
      Fixes: 2ec220e2 ("proc: add /proc/*/stack")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Ken Chen <kenchen@google.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8566a92
    • Vitaly Kuznetsov's avatar
      tools: hv: fcopy: set 'error' in case an unknown operation was requested · 4de0fb95
      Vitaly Kuznetsov authored
      commit c2d68afb upstream.
      
      'error' variable is left uninitialized in case we see an unknown operation.
      As we don't immediately return and proceed to pwrite() we need to set it
      to something, HV_E_FAIL sounds good enough.
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4de0fb95
    • Dexuan Cui's avatar
      Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() · 1d24e260
      Dexuan Cui authored
      commit 41e270f6 upstream.
      
      With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
      BUG: using smp_processor_id() in preemptible [00000000]
      
      Fix the false warning by using get/put_cpu().
      
      Here vmbus_connect() sends a message to the host and waits for the
      host's response. The host will deliver the response message and an
      interrupt on CPU msg->target_vcpu, and later the interrupt handler
      will wake up vmbus_connect(). vmbus_connect() doesn't really have
      to run on the same cpu as CPU msg->target_vcpu, so it's safe to
      call put_cpu() just here.
      Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
      Cc: stable@vger.kernel.org
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d24e260
    • Ricardo Ribalda Delgado's avatar
      gpiolib: Free the last requested descriptor · 119bf947
      Ricardo Ribalda Delgado authored
      commit 19a4fbff upstream.
      
      The current code only frees N-1 gpios if an error occurs during
      gpiod_set_transitory, gpiod_direction_output or gpiod_direction_input.
      Leading to gpios that cannot be used by userspace nor other drivers.
      
      Cc: Timur Tabi <timur@codeaurora.org>
      Cc: stable@vger.kernel.org
      Fixes: ab3dbcf7 ("gpioib: do not free unrequested descriptors)
      Reported-by: default avatarJan Lorenzen <jl@newtec.dk>
      Reported-by: default avatarJim Paris <jim@jtan.com>
      Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      119bf947
    • Horia Geantă's avatar
      crypto: caam/jr - fix ablkcipher_edesc pointer arithmetic · 1df517a4
      Horia Geantă authored
      commit 13cc6f48 upstream.
      
      In some cases the zero-length hw_desc array at the end of
      ablkcipher_edesc struct requires for 4B of tail padding.
      
      Due to tail padding and the way pointers to S/G table and IV
      are computed:
      	edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) +
      			 desc_bytes;
      	iv = (u8 *)edesc->hw_desc + desc_bytes + sec4_sg_bytes;
      first 4 bytes of IV are overwritten by S/G table.
      
      Update computation of pointer to S/G table to rely on offset of hw_desc
      member and not on sizeof() operator.
      
      Cc: <stable@vger.kernel.org> # 4.13+
      Fixes: 115957bb ("crypto: caam - fix IV DMA mapping and updating")
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1df517a4
    • Leonard Crestez's avatar
      crypto: mxs-dcp - Fix wait logic on chan threads · 3b1a8535
      Leonard Crestez authored
      commit d80771c0 upstream.
      
      When compiling with CONFIG_DEBUG_ATOMIC_SLEEP=y the mxs-dcp driver
      prints warnings such as:
      
      WARNING: CPU: 0 PID: 120 at kernel/sched/core.c:7736 __might_sleep+0x98/0x9c
      do not call blocking ops when !TASK_RUNNING; state=1 set at [<8081978c>] dcp_chan_thread_sha+0x3c/0x2ec
      
      The problem is that blocking ops will manipulate current->state
      themselves so it is not allowed to call them between
      set_current_state(TASK_INTERRUPTIBLE) and schedule().
      
      Fix this by converting the per-chan mutex to a spinlock (it only
      protects tiny list ops anyway) and rearranging the wait logic so that
      callbacks are called current->state as TASK_RUNNING. Those callbacks
      will indeed call blocking ops themselves so this is required.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b1a8535
    • Waiman Long's avatar
      crypto: qat - Fix KASAN stack-out-of-bounds bug in adf_probe() · 90ecb700
      Waiman Long authored
      commit ba439a6c upstream.
      
      The following KASAN warning was printed when booting a 64-bit kernel
      on some systems with Intel CPUs:
      
      [   44.512826] ==================================================================
      [   44.520165] BUG: KASAN: stack-out-of-bounds in find_first_bit+0xb0/0xc0
      [   44.526786] Read of size 8 at addr ffff88041e02fc50 by task kworker/0:2/124
      
      [   44.535253] CPU: 0 PID: 124 Comm: kworker/0:2 Tainted: G               X --------- ---  4.18.0-12.el8.x86_64+debug #1
      [   44.545858] Hardware name: Intel Corporation PURLEY/PURLEY, BIOS BKVDTRL1.86B.0005.D08.1712070559 12/07/2017
      [   44.555682] Workqueue: events work_for_cpu_fn
      [   44.560043] Call Trace:
      [   44.562502]  dump_stack+0x9a/0xe9
      [   44.565832]  print_address_description+0x65/0x22e
      [   44.570683]  ? find_first_bit+0xb0/0xc0
      [   44.570689]  kasan_report.cold.6+0x92/0x19f
      [   44.578726]  find_first_bit+0xb0/0xc0
      [   44.578737]  adf_probe+0x9eb/0x19a0 [qat_c62x]
      [   44.578751]  ? adf_remove+0x110/0x110 [qat_c62x]
      [   44.591490]  ? mark_held_locks+0xc8/0x140
      [   44.591498]  ? _raw_spin_unlock+0x30/0x30
      [   44.591505]  ? trace_hardirqs_on_caller+0x381/0x570
      [   44.604418]  ? adf_remove+0x110/0x110 [qat_c62x]
      [   44.604427]  local_pci_probe+0xd4/0x180
      [   44.604432]  ? pci_device_shutdown+0x110/0x110
      [   44.617386]  work_for_cpu_fn+0x51/0xa0
      [   44.621145]  process_one_work+0x8fe/0x16e0
      [   44.625263]  ? pwq_dec_nr_in_flight+0x2d0/0x2d0
      [   44.629799]  ? lock_acquire+0x14c/0x400
      [   44.633645]  ? move_linked_works+0x12e/0x2a0
      [   44.637928]  worker_thread+0x536/0xb50
      [   44.641690]  ? __kthread_parkme+0xb6/0x180
      [   44.645796]  ? process_one_work+0x16e0/0x16e0
      [   44.650160]  kthread+0x30c/0x3d0
      [   44.653400]  ? kthread_create_worker_on_cpu+0xc0/0xc0
      [   44.658457]  ret_from_fork+0x3a/0x50
      
      [   44.663557] The buggy address belongs to the page:
      [   44.668350] page:ffffea0010780bc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      [   44.676356] flags: 0x17ffffc0000000()
      [   44.680023] raw: 0017ffffc0000000 ffffea0010780bc8 ffffea0010780bc8 0000000000000000
      [   44.687769] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
      [   44.695510] page dumped because: kasan: bad access detected
      
      [   44.702578] Memory state around the buggy address:
      [   44.707372]  ffff88041e02fb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   44.714593]  ffff88041e02fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   44.721810] >ffff88041e02fc00: 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 f2 f2 f2 f2
      [   44.729028]                                                  ^
      [   44.734864]  ffff88041e02fc80: f2 f2 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00
      [   44.742082]  ffff88041e02fd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   44.749299] ==================================================================
      
      Looking into the code:
      
        int ret, bar_mask;
          :
        for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
      
      It is casting a 32-bit integer pointer to a 64-bit unsigned long
      pointer. There are two problems here. First, the 32-bit pointer address
      may not be 64-bit aligned. Secondly, it is accessing an extra 4 bytes.
      
      This is fixed by changing the bar_mask type to unsigned long.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarWaiman Long <longman@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90ecb700
    • Kai-Heng Feng's avatar
      ALSA: hda/realtek - Cannot adjust speaker's volume on Dell XPS 27 7760 · a5bb359c
      Kai-Heng Feng authored
      commit 709ae62e upstream.
      
      The issue is the same as commit dd9aa335 ("ALSA: hda/realtek - Can't
      adjust speaker's volume on a Dell AIO"), the output requires to connect
      to a node with Amp-out capability.
      
      Applying the same fixup ALC298_FIXUP_SPK_VOLUME can fix the issue.
      
      BugLink: https://bugs.launchpad.net/bugs/1775068Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a5bb359c
    • Singh, Brijesh's avatar
      iommu/amd: Clear memory encryption mask from physical address · 06f93e40
      Singh, Brijesh authored
      commit b3e9b515 upstream.
      
      Boris Ostrovsky reported a memory leak with device passthrough when SME
      is active.
      
      The VFIO driver uses iommu_iova_to_phys() to get the physical address for
      an iova. This physical address is later passed into vfio_unmap_unpin() to
      unpin the memory. The vfio_unmap_unpin() uses pfn_valid() before unpinning
      the memory. The pfn_valid() check was failing because encryption mask was
      part of the physical address returned. This resulted in the memory not
      being unpinned and therefore leaked after the guest terminates.
      
      The memory encryption mask must be cleared from the physical address in
      iommu_iova_to_phys().
      
      Fixes: 2543a786 ("iommu/amd: Allow the AMD IOMMU to work with memory encryption")
      Reported-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: <iommu@lists.linux-foundation.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: kvm@vger.kernel.org
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: <stable@vger.kernel.org> # 4.14+
      Signed-off-by: default avatarBrijesh Singh <brijesh.singh@amd.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      06f93e40
    • Aurelien Aptel's avatar
      smb2: fix missing files in root share directory listing · dcdb2262
      Aurelien Aptel authored
      commit 0595751f upstream.
      
      When mounting a Windows share that is the root of a drive (eg. C$)
      the server does not return . and .. directory entries. This results in
      the smb2 code path erroneously skipping the 2 first entries.
      
      Pseudo-code of the readdir() code path:
      
      cifs_readdir(struct file, struct dir_context)
          initiate_cifs_search            <-- if no reponse cached yet
              server->ops->query_dir_first
      
          dir_emit_dots
              dir_emit                    <-- adds "." and ".." if we're at pos=0
      
          find_cifs_entry
              initiate_cifs_search        <-- if pos < start of current response
                                               (restart search)
              server->ops->query_dir_next <-- if pos > end of current response
                                               (fetch next search res)
      
          for(...)                        <-- loops over cur response entries
                                                starting at pos
              cifs_filldir                <-- skip . and .., emit entry
                  cifs_fill_dirent
                  dir_emit
      	pos++
      
      A) dir_emit_dots() always adds . & ..
         and sets the current dir pos to 2 (0 and 1 are done).
      
      Therefore we always want the index_to_find to be 2 regardless of if
      the response has . and ..
      
      B) smb1 code initializes index_of_last_entry with a +2 offset
      
        in cifssmb.c CIFSFindFirst():
      		psrch_inf->index_of_last_entry = 2 /* skip . and .. */ +
      			psrch_inf->entries_in_buffer;
      
      Later in find_cifs_entry() we want to find the next dir entry at pos=2
      as a result of (A)
      
      	first_entry_in_buffer = cfile->srch_inf.index_of_last_entry -
      					cfile->srch_inf.entries_in_buffer;
      
      This var is the dir pos that the first entry in the buffer will
      have therefore it must be 2 in the first call.
      
      If we don't offset index_of_last_entry by 2 (like in (B)),
      first_entry_in_buffer=0 but we were instructed to get pos=2 so this
      code in find_cifs_entry() skips the 2 first which is ok for non-root
      shares, as it skips . and .. from the response but is not ok for root
      shares where the 2 first are actual files
      
      		pos_in_buf = index_to_find - first_entry_in_buffer;
                      // pos_in_buf=2
      		// we skip 2 first response entries :(
      		for (i = 0; (i < (pos_in_buf)) && (cur_ent != NULL); i++) {
      			/* go entry by entry figuring out which is first */
      			cur_ent = nxt_dir_entry(cur_ent, end_of_smb,
      						cfile->srch_inf.info_level);
      		}
      
      C) cifs_filldir() skips . and .. so we can safely ignore them for now.
      
      Sample program:
      
      int main(int argc, char **argv)
      {
      	const char *path = argc >= 2 ? argv[1] : ".";
      	DIR *dh;
      	struct dirent *de;
      
      	printf("listing path <%s>\n", path);
      	dh = opendir(path);
      	if (!dh) {
      		printf("opendir error %d\n", errno);
      		return 1;
      	}
      
      	while (1) {
      		de = readdir(dh);
      		if (!de) {
      			if (errno) {
      				printf("readdir error %d\n", errno);
      				return 1;
      			}
      			printf("end of listing\n");
      			break;
      		}
      		printf("off=%lu <%s>\n", de->d_off, de->d_name);
      	}
      
      	return 0;
      }
      
      Before the fix with SMB1 on root shares:
      
      <.>            off=1
      <..>           off=2
      <$Recycle.Bin> off=3
      <bootmgr>      off=4
      
      and on non-root shares:
      
      <.>    off=1
      <..>   off=4  <-- after adding .., the offsets jumps to +2 because
      <2536> off=5       we skipped . and .. from response buffer (C)
      <411>  off=6       but still incremented pos
      <file> off=7
      <fsx>  off=8
      
      Therefore the fix for smb2 is to mimic smb1 behaviour and offset the
      index_of_last_entry by 2.
      
      Test results comparing smb1 and smb2 before/after the fix on root
      share, non-root shares and on large directories (ie. multi-response
      dir listing):
      
      PRE FIX
      =======
      pre-1-root VS pre-2-root:
              ERR pre-2-root is missing [bootmgr, $Recycle.Bin]
      pre-1-nonroot VS pre-2-nonroot:
              OK~ same files, same order, different offsets
      pre-1-nonroot-large VS pre-2-nonroot-large:
              OK~ same files, same order, different offsets
      
      POST FIX
      ========
      post-1-root VS post-2-root:
              OK same files, same order, same offsets
      post-1-nonroot VS post-2-nonroot:
              OK same files, same order, same offsets
      post-1-nonroot-large VS post-2-nonroot-large:
              OK same files, same order, same offsets
      
      REGRESSION?
      ===========
      pre-1-root VS post-1-root:
              OK same files, same order, same offsets
      pre-1-nonroot VS post-1-nonroot:
              OK same files, same order, same offsets
      
      BugLink: https://bugzilla.samba.org/show_bug.cgi?id=13107Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Signed-off-by: default avatarPaulo Alcantara <palcantara@suse.deR>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      CC: Stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dcdb2262
    • Andreas Gruenbacher's avatar
      sysfs: Do not return POSIX ACL xattrs via listxattr · b420b7b7
      Andreas Gruenbacher authored
      commit ffc4c922 upstream.
      
      Commit 786534b9 introduced a regression that caused listxattr to
      return the POSIX ACL attribute names even though sysfs doesn't support
      POSIX ACLs.  This happens because simple_xattr_list checks for NULL
      i_acl / i_default_acl, but inode_init_always initializes those fields
      to ACL_NOT_CACHED ((void *)-1).  For example:
          $ getfattr -m- -d /sys
          /sys: system.posix_acl_access: Operation not supported
          /sys: system.posix_acl_default: Operation not supported
      Fix this in simple_xattr_list by checking if the filesystem supports POSIX ACLs.
      
      Fixes: 786534b9 ("tmpfs: listxattr should include POSIX ACL xattrs")
      Reported-by: default avatarMarc Aurèle La France <tsi@tuyoix.net>
      Tested-by: default avatarMarc Aurèle La France <tsi@tuyoix.net>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Cc: stable@vger.kernel.org # v4.5+
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b420b7b7
    • Miklos Szeredi's avatar
      ovl: fix format of setxattr debug · fa7d75f6
      Miklos Szeredi authored
      commit 1a8f8d2a upstream.
      
      Format has a typo: it was meant to be "%.*s", not "%*s".  But at some point
      callers grew nonprintable values as well, so use "%*pE" instead with a
      maximized length.
      Reported-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: 3a1e819b ("ovl: store file handle of lower inode on copy up")
      Cc: <stable@vger.kernel.org> # v4.12
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fa7d75f6
    • Amir Goldstein's avatar
      ovl: fix memory leak on unlink of indexed file · 8d75ecc1
      Amir Goldstein authored
      commit 63e13252 upstream.
      
      The memory leak was detected by kmemleak when running xfstests
      overlay/051,053
      
      Fixes: caf70cb2 ("ovl: cleanup orphan index entries")
      Cc: <stable@vger.kernel.org> # v4.13
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d75ecc1
    • Amir Goldstein's avatar
      ovl: fix access beyond unterminated strings · be406434
      Amir Goldstein authored
      commit 601350ff upstream.
      
      KASAN detected slab-out-of-bounds access in printk from overlayfs,
      because string format used %*s instead of %.*s.
      
      > BUG: KASAN: slab-out-of-bounds in string+0x298/0x2d0 lib/vsprintf.c:604
      > Read of size 1 at addr ffff8801c36c66ba by task syz-executor2/27811
      >
      > CPU: 0 PID: 27811 Comm: syz-executor2 Not tainted 4.19.0-rc5+ #36
      ...
      >  printk+0xa7/0xcf kernel/printk/printk.c:1996
      >  ovl_lookup_index.cold.15+0xe8/0x1f8 fs/overlayfs/namei.c:689
      
      Reported-by: syzbot+376cea2b0ef340db3dd4@syzkaller.appspotmail.com
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Fixes: 359f392c ("ovl: lookup index entry for copy up origin")
      Cc: <stable@vger.kernel.org> # v4.13
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be406434