OSDN Git Service

sagit-ice-cold/kernel_xiaomi_msm8998.git
5 years agonet: memset smsg to avoid the padding data
Kaustubh Pandey [Mon, 20 Aug 2018 07:30:36 +0000 (13:00 +0530)]
net: memset smsg to avoid the padding data

memset smsg to avoid the padding data of kernel to be shared
with user space. Fix is to set fields event to all "0", but there is
actually 6 bytes padding between "sktype" and "skflags", so memset was
done to set all the padding bits to 0.

CRs-Fixed: 2287852

Change-Id: I435486b80ad19c5fa54b098680623e7a4f080198
Signed-off-by: Kaustubh Pandey <kapandey@codeaurora.org>
Acked-by: Chinmay Agarwal <chinagar@qti.qualcomm.com>
5 years agoMerge "iommu/arm-smmu: Add Hibernation support"
Linux Build Service Account [Tue, 21 Aug 2018 20:10:24 +0000 (13:10 -0700)]
Merge "iommu/arm-smmu: Add Hibernation support"

5 years agoiommu/arm-smmu: Add Hibernation support
Siddhartha Agrawal [Fri, 22 Jun 2018 20:09:03 +0000 (13:09 -0700)]
iommu/arm-smmu: Add Hibernation support

This adds support for saving the arm-smmu client's context
just before going into hibernation. This context is restored
on the subesequent hibernate restore.
Also, invalidate the TLB during the restore phase to avoid
wrong translations post-resume.

Change-Id: Idd8d12bb4d13f8a62bd51e0adaad82bd92f658ee
Signed-off-by: vkakani <vkakani@codeaurora.org>
Signed-off-by: Arun KS <arunks@codeaurora.org>
Signed-off-by: Atul Raut <araut@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
5 years agoRevert "usb: phy: dual-role: update sysfs attrs when changed"
Jack Pham [Sat, 18 Aug 2018 07:06:58 +0000 (00:06 -0700)]
Revert "usb: phy: dual-role: update sysfs attrs when changed"

This reverts commit 563b2f7a6bed72d34560df5f4358e948eb52a43f.

The previous approach of dynamically updating the writeable
permission bits of the power/data_role attributes only works
if the userspace application has root permission since the
call to sysfs_update_group() removes and re-adds the files. If
they had previously been chown/chgrp'ed, the ownership would be
reset. On the other hand, if there was a ueventd rule to
dynamically update the ownership, then the mode would always
be overridden with the static umask given in the ueventd rule,
contradicting the driver's determination of writeability.

Hence, the more comprehensive fix should be done in userspace
to not rely solely on writeability. Still, this change needs
to be reverted since it can still cause a race between ueventd
and the userspace service trying to check writability.

Change-Id: Ic667a97f2bae41e5a86ee45565518b06db959b36
Signed-off-by: Jack Pham <jackp@codeaurora.org>
5 years agoMerge "platform: msm: resolve NULL pointer dereference issue"
Linux Build Service Account [Mon, 20 Aug 2018 15:15:53 +0000 (08:15 -0700)]
Merge "platform: msm: resolve NULL pointer dereference issue"

5 years agoMerge "msm: adsprpc: DSP device node to provide restricted access to ADSP/SLPI"
Linux Build Service Account [Mon, 20 Aug 2018 07:38:29 +0000 (00:38 -0700)]
Merge "msm: adsprpc: DSP device node to provide restricted access to ADSP/SLPI"

5 years agoMerge "drm: msm: update dsi state context when splash is on"
Linux Build Service Account [Fri, 17 Aug 2018 14:09:10 +0000 (07:09 -0700)]
Merge "drm: msm: update dsi state context when splash is on"

5 years agoARM: dts: msm: set qcom,guard-memory property for rmtfs on sdm660
Ankit Jain [Mon, 9 Jul 2018 10:09:52 +0000 (15:39 +0530)]
ARM: dts: msm: set qcom,guard-memory property for rmtfs on sdm660

This is needed to address the XPU limitation, so that the
shared memory is not contiguous with other memory allocations
that may happen from other clients in the system.

Change-Id: Ibc9961245f32ecc63892007a3d12b7956cf63e67
Signed-off-by: Ankit Jain <jankit@codeaurora.org>
5 years agouio: msm_sharedmem: add guard page around shared memory
Sahitya Tummala [Thu, 5 Oct 2017 09:09:40 +0000 (14:39 +0530)]
uio: msm_sharedmem: add guard page around shared memory

If guard_memory dtsi property is set, then the shared memory
region will be guarded by SZ_4K at the start and at the end.
This is needed to overcome the XPU limitation on few MSM HW,
so as to make this memory not contiguous with other allocations
that may possibly happen from other clients in the system.

Change-Id: I57637619cea8fe7f0f7254624e07177ea4a4fce0
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
5 years agoplatform: msm: resolve NULL pointer dereference issue
Yao Jiang [Mon, 13 Aug 2018 04:20:57 +0000 (12:20 +0800)]
platform: msm: resolve NULL pointer dereference issue

Fix some null pointer dereference flaw and parameter not init issues.

change-Id: I0ed5f3f62c3794775bf97d353c4e50dd8ceb32da
Signed-off-by: Yao Jiang <yaojia@codeaurora.org>
5 years agoMerge "q6asm: retry asm_open_read and asm_open_loopback when session id conflict"
Linux Build Service Account [Wed, 15 Aug 2018 12:58:52 +0000 (05:58 -0700)]
Merge "q6asm: retry asm_open_read and asm_open_loopback when session id conflict"

5 years agoMerge "drm/msm: Clear the mode private flags before setting"
Linux Build Service Account [Wed, 15 Aug 2018 03:44:03 +0000 (20:44 -0700)]
Merge "drm/msm: Clear the mode private flags before setting"

5 years agoq6asm: retry asm_open_read and asm_open_loopback when session id conflict
Erin Yan [Thu, 9 Aug 2018 02:21:31 +0000 (10:21 +0800)]
q6asm: retry asm_open_read and asm_open_loopback when session id conflict

The ADSP asm session ids are managed by the kernel driver. It's all right
for native use cases. But for virtualization use cases, there's no way to
synchronize the session ids' status among virtual machines.  Playing back
in one virtual machine is probably failed, because the session id may had
been occupied by a use case in another virtual machine.

The patch allowed audio capture stream and loopback stream to try all
available session ids in case of session id conflict error, to support
concurrent playback from multiple virtual machines.

Change-Id: I01b4da65f3e5716dd14c20c614b53f3c45dd9ea3
Signed-off-by: Erin Yan <xinyey@codeaurora.org>
5 years agoMerge "Merge android-4.4.146 (13962260) into msm-4.4"
Linux Build Service Account [Tue, 14 Aug 2018 15:35:08 +0000 (08:35 -0700)]
Merge "Merge android-4.4.146 (13962260) into msm-4.4"

5 years agoMerge "Merge android-4.4.145 (05670d3) into msm-4.4"
Linux Build Service Account [Tue, 14 Aug 2018 15:35:07 +0000 (08:35 -0700)]
Merge "Merge android-4.4.145 (05670d3) into msm-4.4"

5 years agoMerge "Merge android-4.4.142 (8ec9fd8) into msm-4.4"
Linux Build Service Account [Tue, 14 Aug 2018 15:35:06 +0000 (08:35 -0700)]
Merge "Merge android-4.4.142 (8ec9fd8) into msm-4.4"

5 years agoMerge "cgroup: Fix deadlock in cpu hotplug path"
Linux Build Service Account [Tue, 14 Aug 2018 15:35:04 +0000 (08:35 -0700)]
Merge "cgroup: Fix deadlock in cpu hotplug path"

5 years agoMerge "ext4: fix check to prevent initializing reserved inodes"
Linux Build Service Account [Tue, 14 Aug 2018 15:35:03 +0000 (08:35 -0700)]
Merge "ext4: fix check to prevent initializing reserved inodes"

5 years agoMerge "power: smb2: expose CHARGE_FULL/CYCLE_COUNT properties"
Linux Build Service Account [Tue, 14 Aug 2018 06:30:09 +0000 (23:30 -0700)]
Merge "power: smb2: expose CHARGE_FULL/CYCLE_COUNT properties"

5 years agoMerge "cnss2: cnss api update for genoa pcie"
Linux Build Service Account [Tue, 14 Aug 2018 06:30:08 +0000 (23:30 -0700)]
Merge "cnss2: cnss api update for genoa pcie"

5 years agocgroup: Fix deadlock in cpu hotplug path
Prateek Sood [Tue, 19 Dec 2017 10:41:54 +0000 (16:11 +0530)]
cgroup: Fix deadlock in cpu hotplug path

Deadlock during cgroup migration from cpu hotplug path when a task T is
being moved from source to destination cgroup.

kworker/0:0
cpuset_hotplug_workfn()
   cpuset_hotplug_update_tasks()
      hotplug_update_tasks_legacy()
        remove_tasks_in_empty_cpuset()
          cgroup_transfer_tasks() // stuck in iterator loop
            cgroup_migrate()
              cgroup_migrate_add_task()

In cgroup_migrate_add_task() it checks for PF_EXITING flag of task T.
Task T will not migrate to destination cgroup. css_task_iter_start()
will keep pointing to task T in loop waiting for task T cg_list node
to be removed.

Task T
do_exit()
  exit_signals() // sets PF_EXITING
  exit_task_namespaces()
    switch_task_namespaces()
      free_nsproxy()
        put_mnt_ns()
          drop_collected_mounts()
            namespace_unlock()
              synchronize_rcu()
                _synchronize_rcu_expedited()
                  schedule_work() // on cpu0 low priority worker pool
                  wait_event() // waiting for work item to execute

Task T inserted a work item in the worklist of cpu0 low priority
worker pool. It is waiting for expedited grace period work item
to execute. This work item will only be executed once kworker/0:0
complete execution of cpuset_hotplug_workfn().

kworker/0:0 ==> Task T ==>kworker/0:0

In case of PF_EXITING task being migrated from source to destination
cgroup, migrate next available task in source cgroup.

Change-Id: I706aeff24c336c660b5a9b3e5a409c5769968960
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
5 years agoext4: fix check to prevent initializing reserved inodes
Theodore Ts'o [Sat, 28 Jul 2018 12:12:04 +0000 (08:12 -0400)]
ext4: fix check to prevent initializing reserved inodes

Commit 8844618d8aa7: "ext4: only look at the bg_flags field if it is
valid" will complain if block group zero does not have the
EXT4_BG_INODE_ZEROED flag set.  Unfortunately, this is not correct,
since a freshly created file system has this flag cleared.  It gets
almost immediately after the file system is mounted read-write --- but
the following somewhat unlikely sequence will end up triggering a
false positive report of a corrupted file system:

   mkfs.ext4 /dev/vdc
   mount -o ro /dev/vdc /vdc
   mount -o remount,rw /dev/vdc

Instead, when initializing the inode table for block group zero, test
to make sure that itable_unused count is not too large, since that is
the case that will result in some or all of the reserved inodes
getting cleared.

This fixes the failures reported by Eric Whiteney when running
generic/230 and generic/231 in the the nojournal test case.

Fixes: 8844618d8aa7 ("ext4: only look at the bg_flags field if it is valid")
Reported-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Git-Repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-Commit: 5012284700775a4e6e3fbe7eac4c543c4874b559
Change-Id: I9ae663e67e6ee32ef0c0e98a9e0ae9193cf7c880
Signed-off-by: Ankit Jain <jankit@codeaurora.org>
5 years agodrm/msm: add DRM_IOCTL_MSM_RMFB2
Lloyd Atkinson [Mon, 30 Jan 2017 22:30:55 +0000 (17:30 -0500)]
drm/msm: add DRM_IOCTL_MSM_RMFB2

Add new remove framebuffer ioctl that simply unreferences the
given framebuffer instead of triggering a shutdown of the CRTC
if the buffer is in active use. This allows the user space to
proactively unref the buffer without triggering an unwanted
shutdown.

Change-Id: Iac06985d069989b28affcf620d4e3feba6d07644
Signed-off-by: Lloyd Atkinson <latkinso@codeaurora.org>
Signed-off-by: Yunyun Cao <yunyunc@codeaurora.org>
5 years agomsm:ipa3: fix the header table gap issue
Skylar Chang [Thu, 10 May 2018 22:44:56 +0000 (15:44 -0700)]
msm:ipa3: fix the header table gap issue

Move those deleted entries to the free
list to avoid the gap in hdr tbl list.

Change-Id: I5f5b6ec845e6b7e52c7079c2a3200a8290616951
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
5 years agomsm: ipa: fix the ipa-hw rules not clean
Skylar Chang [Thu, 3 May 2018 09:18:34 +0000 (02:18 -0700)]
msm: ipa: fix the ipa-hw rules not clean

After getting reset ioctl from user-space
module, the caches in ipa-driver are clean
however ipa-hw still has it. The fix is
to commit those caches in ipa-hw.

Change-Id: Iee0009b2bf3cdff2979d1fdba629c86a7c5afe21
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
5 years agoMerge "soc: qcom: pil: Disable a clock to maintain clock state across modem SSR"
Linux Build Service Account [Fri, 10 Aug 2018 18:08:40 +0000 (11:08 -0700)]
Merge "soc: qcom: pil: Disable a clock to maintain clock state across modem SSR"

5 years agoMerge "diag: Add NULL checks for the mask and mask pointer"
Linux Build Service Account [Fri, 10 Aug 2018 18:08:38 +0000 (11:08 -0700)]
Merge "diag: Add NULL checks for the mask and mask pointer"

5 years agoMerge "soc: qcom: pil: Remove a register read as it causes an unclocked access"
Linux Build Service Account [Fri, 10 Aug 2018 18:08:37 +0000 (11:08 -0700)]
Merge "soc: qcom: pil: Remove a register read as it causes an unclocked access"

5 years agosoc: qcom: pil: Disable a clock to maintain clock state across modem SSR
Anant Goel [Tue, 31 Jul 2018 23:38:34 +0000 (16:38 -0700)]
soc: qcom: pil: Disable a clock to maintain clock state across modem SSR

A disable and unprepare is called on a clock which is voted for, but never
unvoted for. By disabling and unpreparing this clock, the clock state is
maintained the same across modem restarts.

Change-Id: I4d6cb219ac718de4b7bad593d7f7aa9fd67b1cef
Signed-off-by: Anant Goel <anantg@codeaurora.org>
5 years agodiag: Add NULL checks for the mask and mask pointer
Manoj Prabhu B [Wed, 18 Jul 2018 09:50:43 +0000 (15:20 +0530)]
diag: Add NULL checks for the mask and mask pointer

The chances of accessing uninitialized mask is prevented
by adding null pointer checks for the mask structure and its
member pointer.

Change-Id: Ibf0467228794b773fc2537d34f1da6719bbb975a
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
5 years agoMerge "sched: walt: fix out-of-bounds access"
Linux Build Service Account [Fri, 10 Aug 2018 02:19:43 +0000 (19:19 -0700)]
Merge "sched: walt: fix out-of-bounds access"

5 years agoMerge "msm: ipa: Add WLAN FW SSR event"
Linux Build Service Account [Fri, 10 Aug 2018 02:19:42 +0000 (19:19 -0700)]
Merge "msm: ipa: Add WLAN FW SSR event"

5 years agoMerge "arm64: hibernate: Support DEBUG_PAGEALLOC"
Linux Build Service Account [Fri, 10 Aug 2018 02:19:35 +0000 (19:19 -0700)]
Merge "arm64: hibernate: Support DEBUG_PAGEALLOC"

5 years agoMerge "arm64: Create sections.h"
Linux Build Service Account [Fri, 10 Aug 2018 02:19:34 +0000 (19:19 -0700)]
Merge "arm64: Create sections.h"

5 years agosoc: qcom: pil: Remove a register read as it causes an unclocked access
Anant Goel [Tue, 31 Jul 2018 21:40:26 +0000 (14:40 -0700)]
soc: qcom: pil: Remove a register read as it causes an unclocked access

A read of a register during the software fatal error handling is removed.
This read causes an unclocked access which prevents the modem subsystem
from succssfully restarting.

Change-Id: I8338830573e55af2e5c9d0f688756d975a3302af
Signed-off-by: Anant Goel <anantg@codeaurora.org>
5 years agoMerge "msm: camera: cpp: Check for valid tx level"
Linux Build Service Account [Thu, 9 Aug 2018 15:19:06 +0000 (08:19 -0700)]
Merge "msm: camera: cpp: Check for valid tx level"

5 years agomsm: ipa: Add WLAN FW SSR event
Mohammed Javid [Mon, 25 Jun 2018 13:28:20 +0000 (18:58 +0530)]
msm: ipa: Add WLAN FW SSR event

Add WLAN FW SSR event to handle FW rejuvenate
scenario.

Change-Id: I417d46cc07f455792906a18f4b6dc8e5ca8ca3de
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
5 years agomsm: camera: cpp: Check for valid tx level
Pratap Nirujogi [Wed, 8 Aug 2018 15:13:29 +0000 (20:43 +0530)]
msm: camera: cpp: Check for valid tx level

TX and RX FIFOs of Microcontroller are used to exchange commands
and messages between Micro FW and CPP driver. TX FIFO depth is
16 32-bit words, incase of errors there is a chance of overflow.
To prevent possible out of bound access, TX FIFO depth or
level is checked for MAX depth before accessing the FIFO.

Change-Id: I5adf39b46ff10e358c4a2c03a2de07d44b99cedb
Signed-off-by: Pratap Nirujogi <pratapn@codeaurora.org>
5 years agoMerge "msm: ADSPRPC: Disable CDSP loader"
Linux Build Service Account [Thu, 9 Aug 2018 01:28:49 +0000 (18:28 -0700)]
Merge "msm: ADSPRPC: Disable CDSP loader"

5 years agoMerge "media: camera: Fix Major and Minor number"
Linux Build Service Account [Thu, 9 Aug 2018 01:28:48 +0000 (18:28 -0700)]
Merge "media: camera: Fix Major and Minor number"

5 years agodrm/msm: Clear the mode private flags before setting
Abhinav Kumar [Tue, 7 Aug 2018 02:30:10 +0000 (19:30 -0700)]
drm/msm: Clear the mode private flags before setting

Clear the display mode private flags before assigning
the new value. These flags retain the values from the
previous mode set which could be stale in cases where
the mode is different across the hotplugs.

Change-Id: I4bd7021970737e5ae22bade3074d8debfeddc7b3
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
5 years agodrm/msm: Clear HDMI VSDB and VCDB info across hotplug
Abhinav Kumar [Tue, 7 Aug 2018 02:24:43 +0000 (19:24 -0700)]
drm/msm: Clear HDMI VSDB and VCDB info across hotplug

SDE connector stores the information related to the HDMI
VSDB and VCDB data blocks. This connector information is
retained till the connector is destroyed which does not
happen across hotplug.

Clear the HDMI VSDB and VCDB related data fields when
the bridge is disabled so that across a hotplug stale
information is not retained.

Change-Id: I4dabfda03a6446f38913ac45d9df2d2ae411a7f0
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
5 years agodrm/msm: refactor Y420CMDB block parsing logic
Abhinav Kumar [Sat, 2 Dec 2017 04:50:44 +0000 (20:50 -0800)]
drm/msm: refactor Y420CMDB block parsing logic

Y420CMDB block parsing is too complex and incorrect
in handling cases where more than one byte of bitmap
is present.

Fix this logic to make it more simple and capable to
handle all such cases.

Change-Id: I7aef80f588ec44def000c9f04e1da4c10020699d
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
5 years agoMerge "ARM: dts: msm: disable pm8994 adc on vplatform"
Linux Build Service Account [Wed, 8 Aug 2018 09:39:39 +0000 (02:39 -0700)]
Merge "ARM: dts: msm: disable pm8994 adc on vplatform"

5 years agoMerge "diag: Add missing protection while accessing session's info"
Linux Build Service Account [Wed, 8 Aug 2018 09:39:38 +0000 (02:39 -0700)]
Merge "diag: Add missing protection while accessing session's info"

5 years agoMerge "ARM: dts: msm: Remove blsp1_uart2 on msm8996 ivi vplatform"
Linux Build Service Account [Wed, 8 Aug 2018 09:39:36 +0000 (02:39 -0700)]
Merge "ARM: dts: msm: Remove blsp1_uart2 on msm8996 ivi vplatform"

5 years agoMerge "uio: msm_sharedmem: Add stub shutdown function"
Linux Build Service Account [Wed, 8 Aug 2018 09:39:33 +0000 (02:39 -0700)]
Merge "uio: msm_sharedmem: Add stub shutdown function"

5 years agomedia: camera: Fix Major and Minor number
Neeraj Soni [Thu, 8 Feb 2018 15:10:05 +0000 (20:40 +0530)]
media: camera: Fix Major and Minor number

Fix TA Major and Minor number.

Change-Id: I65a800ec8d84445efc05b9763062d476b1d0f27a
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
5 years agosched: walt: fix out-of-bounds access
John Dias [Fri, 22 Jun 2018 19:27:38 +0000 (12:27 -0700)]
sched: walt: fix out-of-bounds access

A computation in update_top_tasks() is indexing
off the end of a top_tasks array. There's code
to limit the index in the computation, but it's
insufficient.

Bug: 110529282
Change-Id: Idb5ff5e5800c014394bcb04638844bf1e057a40c
Signed-off-by: John Dias <joaodias@google.com>
[pkondeti@codeaurora.org: Backported to 4.4 for HMP scheduler]
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
5 years agoARM: dts: msm: disable pm8994 adc on vplatform
Zhiqiang Tu [Wed, 8 Aug 2018 02:16:49 +0000 (10:16 +0800)]
ARM: dts: msm: disable pm8994 adc on vplatform

Disable adc since they are not needed.

Change-Id: I5e08ae819f8c5c8a25eca4e523b214606105cb65
Signed-off-by: Zhiqiang Tu <ztu@codeaurora.org>
5 years agoARM: dts: msm: Remove blsp1_uart2 on msm8996 ivi vplatform
Zhiqiang Tu [Tue, 7 Aug 2018 05:31:27 +0000 (13:31 +0800)]
ARM: dts: msm: Remove blsp1_uart2 on msm8996 ivi vplatform

Remove blsp1_uart since it is not needed.

Change-Id: Id0327fc601f87376eebfbe6d3cfb06b84ed9a407
Signed-off-by: Zhiqiang Tu <ztu@codeaurora.org>
5 years agouio: msm_sharedmem: Add stub shutdown function
Anant Goel [Sat, 4 Aug 2018 06:12:17 +0000 (23:12 -0700)]
uio: msm_sharedmem: Add stub shutdown function

A stub shutdown function is added as the default
implementation. This function is used by targets
that do not need to free their memory when the
driver is shutdown.

Change-Id: I073cda4fee7a1c6c34c5ba72d9ba73478ef2d90d
Signed-off-by: Anant Goel <anantg@codeaurora.org>
5 years agoarm64: hibernate: Support DEBUG_PAGEALLOC
James Morse [Thu, 19 Jul 2018 05:25:14 +0000 (10:55 +0530)]
arm64: hibernate: Support DEBUG_PAGEALLOC

DEBUG_PAGEALLOC removes the valid bit of page table entries to prevent
any access to unallocated memory. Hibernate uses this as a hint that those
pages don't need to be saved/restored. This patch adds the
kernel_page_present() function it uses.

hibernate.c copies the resume kernel's linear map for use during restore.
Add _copy_pte() to fill-in the holes made by DEBUG_PAGEALLOC in the resume
kernel, so we can restore data the original kernel had at these addresses.

Finally, DEBUG_PAGEALLOC means the linear-map alias of KERNEL_START to
KERNEL_END may have holes in it, so we can't lazily clean this whole
area to the PoC. Only clean the new mmuoff region, and the kernel/kvm
idmaps.

This reverts commit da24eb1f3f9e2c7b75c5f8c40d8e48e2c4789596.

Change-Id: I862226802c9c726590c89e3d9e8062ed680309f3
Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Git-Commit: 5ebe3a44cc744d11cb60d8438106a9322b7c04dc
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Arun KS <arunks@codeaurora.org>
5 years agoarm64: vmlinux.ld: Add mmuoff data sections and move mmuoff text into idmap
James Morse [Thu, 19 Jul 2018 05:19:13 +0000 (10:49 +0530)]
arm64: vmlinux.ld: Add mmuoff data sections and move mmuoff text into idmap

Resume from hibernate needs to clean any text executed by the kernel with
the MMU off to the PoC. Collect these functions together into the
.idmap.text section as all this code is tightly coupled and also needs
the same cleaning after resume.

Data is more complicated, secondary_holding_pen_release is written with
the MMU on, clean and invalidated, then read with the MMU off. In contrast
__boot_cpu_mode is written with the MMU off, the corresponding cache line
is invalidated, so when we read it with the MMU on we don't get stale data.
These cache maintenance operations conflict with each other if the values
are within a Cache Writeback Granule (CWG) of each other.
Collect the data into two sections .mmuoff.data.read and .mmuoff.data.write,
the linker script ensures mmuoff.data.write section is aligned to the
architectural maximum CWG of 2KB.

Change-Id: I3f5add863896e0acaa54dd11929fc1d553d402f4
Signed-off-by: James Morse <james.morse@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Git-Commit: b61130381120398876b86282082ad9f24976dfcf
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Arun KS <arunks@codeaurora.org>
5 years agoarm64: Create sections.h
James Morse [Thu, 19 Jul 2018 04:45:00 +0000 (10:15 +0530)]
arm64: Create sections.h

Each time new section markers are added, kernel/vmlinux.ld.S is updated,
and new extern char __start_foo[] definitions are scattered through the
tree.

Create asm/include/sections.h to collect these definitions (and include
the existing asm-generic version).

Change-Id: I40cf712810291cde8f362fc41bb572b2e94daca1
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Git-Commit: ee78fdc71db1ce9a437b9ca17e31063996b71ec1
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Arun KS <arunks@codeaurora.org>
5 years agoarm64: kernel: avoid literal load of virtual address with MMU off
Ard Biesheuvel [Wed, 17 Aug 2016 15:54:41 +0000 (17:54 +0200)]
arm64: kernel: avoid literal load of virtual address with MMU off

Literal loads of virtual addresses are subject to runtime relocation when
CONFIG_RELOCATABLE=y, and given that the relocation routines run with the
MMU and caches enabled, literal loads of relocated values performed with
the MMU off are not guaranteed to return the latest value unless the
memory covering the literal is cleaned to the PoC explicitly.

So defer the literal load until after the MMU has been enabled, just like
we do for primary_switch() and secondary_switch() in head.S.

Change-Id: I11b1884662f37bc2664f286f6278e4a6af2d5c76
Fixes: 1e48ef7fcc37 ("arm64: add support for building vmlinux as a relocatable PIE binary")
Cc: <stable@vger.kernel.org> # 4.6+
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Git-Commit: bc9f3d7788a88d080a30599bde68f383daf8f8a5
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Arun KS <arunks@codeaurora.org>
5 years agoMerge "ipa: update wlan upstream iface name"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:16 +0000 (15:24 -0700)]
Merge "ipa: update wlan upstream iface name"

5 years agoMerge "msm: mdss: Change function from disbale_irq_nosync to disbale_irq"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:15 +0000 (15:24 -0700)]
Merge "msm: mdss: Change function from disbale_irq_nosync to disbale_irq"

5 years agoMerge "ASoC: wcd934x-dsp-cntl: initialize local char array val"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:13 +0000 (15:24 -0700)]
Merge "ASoC: wcd934x-dsp-cntl: initialize local char array val"

5 years agoMerge "diag: Protect md_info structure while reallocation"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:11 +0000 (15:24 -0700)]
Merge "diag: Protect md_info structure while reallocation"

5 years agoMerge "msm: ipa3: using rate limit api for ioctl calls"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:09 +0000 (15:24 -0700)]
Merge "msm: ipa3: using rate limit api for ioctl calls"

5 years agoMerge "msm: ipa3: fix hdr offset issue"
Linux Build Service Account [Tue, 7 Aug 2018 22:24:06 +0000 (15:24 -0700)]
Merge "msm: ipa3: fix hdr offset issue"

5 years agomsm: adsprpc: DSP device node to provide restricted access to ADSP/SLPI
Tharun Kumar Merugu [Mon, 4 Jun 2018 18:21:27 +0000 (11:21 -0700)]
msm: adsprpc: DSP device node to provide restricted access to ADSP/SLPI

Support 2 separate device nodes with this change, one for ADSP/SLPI
and another for CDSP.

Change-Id: I2a09ebfdeccd9a092b1a3602c249b2727ec91c92
Acked-by: Amol Mahesh <amahesh@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
5 years agoipa: update wlan upstream iface name
Mohammed Javid [Fri, 3 Aug 2018 09:26:35 +0000 (14:56 +0530)]
ipa: update wlan upstream iface name

Update WLAN upstream name to support STA SAP scenario
with wlan1 iface.

Change-Id: I0223c5b4aff8dfe24562a2c6d4ac581a7843224e
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
5 years agodiag: Add missing protection while accessing session's info
Hardik Arya [Mon, 9 Apr 2018 09:19:40 +0000 (14:49 +0530)]
diag: Add missing protection while accessing session's info

Currently, mutex protection is missing while accessing md session's
info via macro. The patch adds proper protection before accessing
the same.

Change-Id: I17b18183407279447229783fd0165337bd173423
Signed-off-by: Hardik Arya <harya@codeaurora.org>
5 years agoMerge android-4.4.146 (13962260) into msm-4.4
Srinivasarao P [Tue, 7 Aug 2018 10:06:11 +0000 (15:36 +0530)]
Merge android-4.4.146 (13962260) into msm-4.4

* refs/heads/tmp-13962260
  Linux 4.4.146
  scsi: sg: fix minor memory leak in error path
  crypto: padlock-aes - Fix Nano workaround data corruption
  kvm: x86: vmx: fix vpid leak
  virtio_balloon: fix another race between migration and ballooning
  net: socket: fix potential spectre v1 gadget in socketcall
  can: ems_usb: Fix memory leak on ems_usb_disconnect()
  squashfs: more metadata hardenings
  squashfs: more metadata hardening
  netlink: Fix spectre v1 gadget in netlink_create()
  net: dsa: Do not suspend/resume closed slave_dev
  inet: frag: enforce memory limits earlier
  tcp: add one more quick ack after after ECN events
  tcp: refactor tcp_ecn_check_ce to remove sk type cast
  tcp: do not aggressively quick ack after ECN events
  tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
  tcp: do not force quickack when receiving out-of-order packets
  NET: stmmac: align DMA stuff to largest cache line length
  xen-netfront: wait xenbus state change when load module manually
  net: lan78xx: fix rx handling before first packet is send
  net: fix amd-xgbe flow-control issue
  ipv4: remove BUG_ON() from fib_compute_spec_dst
  ASoC: pxa: Fix module autoload for platform drivers
  dmaengine: pxa_dma: remove duplicate const qualifier
  ext4: check for allocation block validity with block group locked
  ext4: fix inline data updates with checksums enabled
  squashfs: be more careful about metadata corruption
  random: mix rdrand with entropy sent in from userspace
  drm: Add DP PSR2 sink enable bit
  media: si470x: fix __be16 annotations
  scsi: megaraid_sas: Increase timeout by 1 sec for non-RAID fastpath IOs
  scsi: scsi_dh: replace too broad "TP9" string with the exact models
  media: omap3isp: fix unbalanced dma_iommu_mapping
  crypto: authenc - don't leak pointers to authenc keys
  crypto: authencesn - don't leak pointers to authenc keys
  usb: hub: Don't wait for connect state at resume for powered-off ports
  microblaze: Fix simpleImage format generation
  audit: allow not equal op for audit by executable
  rsi: Fix 'invalid vdd' warning in mmc
  ipconfig: Correctly initialise ic_nameservers
  drm/gma500: fix psb_intel_lvds_mode_valid()'s return type
  memory: tegra: Apply interrupts mask per SoC
  memory: tegra: Do not handle spurious interrupts
  ALSA: hda/ca0132: fix build failure when a local macro is defined
  drm/atomic: Handling the case when setting old crtc for plane
  media: siano: get rid of __le32/__le16 cast warnings
  bpf: fix references to free_bpf_prog_info() in comments
  thermal: exynos: fix setting rising_threshold for Exynos5433
  scsi: megaraid: silence a static checker bug
  scsi: 3w-xxxx: fix a missing-check bug
  scsi: 3w-9xxx: fix a missing-check bug
  perf: fix invalid bit in diagnostic entry
  s390/cpum_sf: Add data entry sizes to sampling trailer entry
  brcmfmac: Add support for bcm43364 wireless chipset
  mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages
  media: saa7164: Fix driver name in debug output
  libata: Fix command retry decision
  media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open()
  dma-iommu: Fix compilation when !CONFIG_IOMMU_DMA
  tty: Fix data race in tty_insert_flip_string_fixed_flag
  HID: i2c-hid: check if device is there before really probing
  powerpc/embedded6xx/hlwd-pic: Prevent interrupts from being handled by Starlet
  drm/radeon: fix mode_valid's return type
  HID: hid-plantronics: Re-resend Update to map button for PTT products
  ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
  media: smiapp: fix timeout checking in smiapp_read_nvm
  md: fix NULL dereference of mddev->pers in remove_and_add_spares()
  regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops
  ALSA: emu10k1: Rate-limit error messages about page errors
  scsi: ufs: fix exception event handling
  mwifiex: correct histogram data with appropriate index
  PCI: pciehp: Request control of native hotplug only if supported
  pinctrl: at91-pio4: add missing of_node_put
  powerpc/8xx: fix invalid register expression in head_8xx.S
  powerpc/powermac: Mark variable x as unused
  powerpc/powermac: Add missing prototype for note_bootable_part()
  powerpc/chrp/time: Make some functions static, add missing header include
  powerpc/32: Add a missing include header
  ath: Add regulatory mapping for Bahamas
  ath: Add regulatory mapping for Bermuda
  ath: Add regulatory mapping for Serbia
  ath: Add regulatory mapping for Tanzania
  ath: Add regulatory mapping for Uganda
  ath: Add regulatory mapping for APL2_FCCA
  ath: Add regulatory mapping for APL13_WORLD
  ath: Add regulatory mapping for ETSI8_WORLD
  ath: Add regulatory mapping for FCC3_ETSIC
  PCI: Prevent sysfs disable of device while driver is attached
  btrfs: qgroup: Finish rescan when hit the last leaf of extent tree
  btrfs: add barriers to btrfs_sync_log before log_commit_wait wakeups
  media: videobuf2-core: don't call memop 'finish' when queueing
  wlcore: sdio: check for valid platform device data before suspend
  mwifiex: handle race during mwifiex_usb_disconnect
  mfd: cros_ec: Fail early if we cannot identify the EC
  ASoC: dpcm: fix BE dai not hw_free and shutdown
  Bluetooth: btusb: Add a new Realtek 8723DE ID 2ff8:b011
  Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning
  iwlwifi: pcie: fix race in Rx buffer allocator
  perf/x86/intel/uncore: Correct fixed counter index check for NHM
  perf/x86/intel/uncore: Correct fixed counter index check in generic code
  usbip: usbip_detach: Fix memory, udev context and udev leak
  f2fs: fix to don't trigger writeback during recovery
  disable loading f2fs module on PAGE_SIZE > 4KB
  RDMA/mad: Convert BUG_ONs to error flows
  powerpc/64s: Fix compiler store ordering to SLB shadow area
  hvc_opal: don't set tb_ticks_per_usec in udbg_init_opal_common()
  infiniband: fix a possible use-after-free bug
  netfilter: ipset: List timing out entries with "timeout 1" instead of zero
  rtc: ensure rtc_set_alarm fails when alarms are not supported
  mm/slub.c: add __printf verification to slab_err()
  mm: vmalloc: avoid racy handling of debugobjects in vunmap
  nfsd: fix potential use-after-free in nfsd4_decode_getdeviceinfo
  ALSA: fm801: add error handling for snd_ctl_add
  ALSA: emu10k1: add error handling for snd_ctl_add
  xen/netfront: raise max number of slots in xennet_get_responses()
  tracing: Quiet gcc warning about maybe unused link variable
  tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
  tracing: Fix possible double free in event_enable_trigger_func()
  tracing: Fix double free of event_trigger_data
  Input: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST
  Input: i8042 - add Lenovo LaVie Z to the i8042 reset list
  Input: elan_i2c - add ACPI ID for lenovo ideapad 330
  MIPS: Fix off-by-one in pci_resource_to_user()
  kernel/sys.c: fix merge error with 4.4.144

Conflicts:
drivers/scsi/ufs/ufshcd.c
include/net/tcp.h
net/socket.c

Change-Id: Ie84fdcf54b0a45508f76ef56330291f54e35ed30
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
5 years agoMerge "msm: kgsl: unload/reload zap shader"
Linux Build Service Account [Tue, 7 Aug 2018 04:52:26 +0000 (21:52 -0700)]
Merge "msm: kgsl: unload/reload zap shader"

5 years agoMerge "cnss2: Clear flag CNSS_DRIVER_UNLOADING after unregister driver finished"
Linux Build Service Account [Tue, 7 Aug 2018 04:52:23 +0000 (21:52 -0700)]
Merge "cnss2: Clear flag CNSS_DRIVER_UNLOADING after unregister driver finished"

5 years agoMerge "cnss2: Skip PCIe link suspend if link has already been suspended"
Linux Build Service Account [Tue, 7 Aug 2018 04:52:19 +0000 (21:52 -0700)]
Merge "cnss2: Skip PCIe link suspend if link has already been suspended"

5 years agoASoC: wcd934x-dsp-cntl: initialize local char array val
Xiaoyu Ye [Tue, 31 Jul 2018 18:34:20 +0000 (11:34 -0700)]
ASoC: wcd934x-dsp-cntl: initialize local char array val

Due to the local char array that stores the codec dsp control command
is not initialized, an invalid command could cause the stack content
to be printed out in kernel dmesg. Initialize the array with memset.

Change-Id: I9573958fbe308c170c203a6a50a94d0540f3e7ce
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
5 years agomsm: ipa3: using rate limit api for ioctl calls
Mohammed Javid [Fri, 13 Oct 2017 08:21:21 +0000 (13:51 +0530)]
msm: ipa3: using rate limit api for ioctl calls

ipav3 ioctl calls input arguments validation failed cases,
replacing IPAERR()/IPAHAL_ERR() with IPAERR_RL()/IPAHAL_ERR_RL()
marco for controlling logs printing on the console.

Change-Id: I0b48b4a2f8b37c71aebe82c7b747b1d8f6c1e143
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
5 years agoMerge 4.4.146 into android-4.4
Greg Kroah-Hartman [Mon, 6 Aug 2018 17:12:19 +0000 (19:12 +0200)]
Merge 4.4.146 into android-4.4

Changes in 4.4.146
MIPS: Fix off-by-one in pci_resource_to_user()
Input: elan_i2c - add ACPI ID for lenovo ideapad 330
Input: i8042 - add Lenovo LaVie Z to the i8042 reset list
Input: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST
tracing: Fix double free of event_trigger_data
tracing: Fix possible double free in event_enable_trigger_func()
tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
tracing: Quiet gcc warning about maybe unused link variable
xen/netfront: raise max number of slots in xennet_get_responses()
ALSA: emu10k1: add error handling for snd_ctl_add
ALSA: fm801: add error handling for snd_ctl_add
nfsd: fix potential use-after-free in nfsd4_decode_getdeviceinfo
mm: vmalloc: avoid racy handling of debugobjects in vunmap
mm/slub.c: add __printf verification to slab_err()
rtc: ensure rtc_set_alarm fails when alarms are not supported
netfilter: ipset: List timing out entries with "timeout 1" instead of zero
infiniband: fix a possible use-after-free bug
hvc_opal: don't set tb_ticks_per_usec in udbg_init_opal_common()
powerpc/64s: Fix compiler store ordering to SLB shadow area
RDMA/mad: Convert BUG_ONs to error flows
disable loading f2fs module on PAGE_SIZE > 4KB
f2fs: fix to don't trigger writeback during recovery
usbip: usbip_detach: Fix memory, udev context and udev leak
perf/x86/intel/uncore: Correct fixed counter index check in generic code
perf/x86/intel/uncore: Correct fixed counter index check for NHM
iwlwifi: pcie: fix race in Rx buffer allocator
Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning
Bluetooth: btusb: Add a new Realtek 8723DE ID 2ff8:b011
ASoC: dpcm: fix BE dai not hw_free and shutdown
mfd: cros_ec: Fail early if we cannot identify the EC
mwifiex: handle race during mwifiex_usb_disconnect
wlcore: sdio: check for valid platform device data before suspend
media: videobuf2-core: don't call memop 'finish' when queueing
btrfs: add barriers to btrfs_sync_log before log_commit_wait wakeups
btrfs: qgroup: Finish rescan when hit the last leaf of extent tree
PCI: Prevent sysfs disable of device while driver is attached
ath: Add regulatory mapping for FCC3_ETSIC
ath: Add regulatory mapping for ETSI8_WORLD
ath: Add regulatory mapping for APL13_WORLD
ath: Add regulatory mapping for APL2_FCCA
ath: Add regulatory mapping for Uganda
ath: Add regulatory mapping for Tanzania
ath: Add regulatory mapping for Serbia
ath: Add regulatory mapping for Bermuda
ath: Add regulatory mapping for Bahamas
powerpc/32: Add a missing include header
powerpc/chrp/time: Make some functions static, add missing header include
powerpc/powermac: Add missing prototype for note_bootable_part()
powerpc/powermac: Mark variable x as unused
powerpc/8xx: fix invalid register expression in head_8xx.S
pinctrl: at91-pio4: add missing of_node_put
PCI: pciehp: Request control of native hotplug only if supported
mwifiex: correct histogram data with appropriate index
scsi: ufs: fix exception event handling
ALSA: emu10k1: Rate-limit error messages about page errors
regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops
md: fix NULL dereference of mddev->pers in remove_and_add_spares()
media: smiapp: fix timeout checking in smiapp_read_nvm
ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback
HID: hid-plantronics: Re-resend Update to map button for PTT products
drm/radeon: fix mode_valid's return type
powerpc/embedded6xx/hlwd-pic: Prevent interrupts from being handled by Starlet
HID: i2c-hid: check if device is there before really probing
tty: Fix data race in tty_insert_flip_string_fixed_flag
dma-iommu: Fix compilation when !CONFIG_IOMMU_DMA
media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open()
libata: Fix command retry decision
media: saa7164: Fix driver name in debug output
mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages
brcmfmac: Add support for bcm43364 wireless chipset
s390/cpum_sf: Add data entry sizes to sampling trailer entry
perf: fix invalid bit in diagnostic entry
scsi: 3w-9xxx: fix a missing-check bug
scsi: 3w-xxxx: fix a missing-check bug
scsi: megaraid: silence a static checker bug
thermal: exynos: fix setting rising_threshold for Exynos5433
bpf: fix references to free_bpf_prog_info() in comments
media: siano: get rid of __le32/__le16 cast warnings
drm/atomic: Handling the case when setting old crtc for plane
ALSA: hda/ca0132: fix build failure when a local macro is defined
memory: tegra: Do not handle spurious interrupts
memory: tegra: Apply interrupts mask per SoC
drm/gma500: fix psb_intel_lvds_mode_valid()'s return type
ipconfig: Correctly initialise ic_nameservers
rsi: Fix 'invalid vdd' warning in mmc
audit: allow not equal op for audit by executable
microblaze: Fix simpleImage format generation
usb: hub: Don't wait for connect state at resume for powered-off ports
crypto: authencesn - don't leak pointers to authenc keys
crypto: authenc - don't leak pointers to authenc keys
media: omap3isp: fix unbalanced dma_iommu_mapping
scsi: scsi_dh: replace too broad "TP9" string with the exact models
scsi: megaraid_sas: Increase timeout by 1 sec for non-RAID fastpath IOs
media: si470x: fix __be16 annotations
drm: Add DP PSR2 sink enable bit
random: mix rdrand with entropy sent in from userspace
squashfs: be more careful about metadata corruption
ext4: fix inline data updates with checksums enabled
ext4: check for allocation block validity with block group locked
dmaengine: pxa_dma: remove duplicate const qualifier
ASoC: pxa: Fix module autoload for platform drivers
ipv4: remove BUG_ON() from fib_compute_spec_dst
net: fix amd-xgbe flow-control issue
net: lan78xx: fix rx handling before first packet is send
xen-netfront: wait xenbus state change when load module manually
NET: stmmac: align DMA stuff to largest cache line length
tcp: do not force quickack when receiving out-of-order packets
tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
tcp: do not aggressively quick ack after ECN events
tcp: refactor tcp_ecn_check_ce to remove sk type cast
tcp: add one more quick ack after after ECN events
inet: frag: enforce memory limits earlier
net: dsa: Do not suspend/resume closed slave_dev
netlink: Fix spectre v1 gadget in netlink_create()
squashfs: more metadata hardening
squashfs: more metadata hardenings
can: ems_usb: Fix memory leak on ems_usb_disconnect()
net: socket: fix potential spectre v1 gadget in socketcall
virtio_balloon: fix another race between migration and ballooning
kvm: x86: vmx: fix vpid leak
crypto: padlock-aes - Fix Nano workaround data corruption
scsi: sg: fix minor memory leak in error path
Linux 4.4.146

Change-Id: Ia7e43a90d0f5603c741811436b8de41884cb2851
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
5 years agoLinux 4.4.146
Greg Kroah-Hartman [Mon, 6 Aug 2018 14:24:42 +0000 (16:24 +0200)]
Linux 4.4.146

5 years agoscsi: sg: fix minor memory leak in error path
Tony Battersby [Thu, 12 Jul 2018 20:30:45 +0000 (16:30 -0400)]
scsi: sg: fix minor memory leak in error path

commit c170e5a8d222537e98aa8d4fddb667ff7a2ee114 upstream.

Fix a minor memory leak when there is an error opening a /dev/sg device.

Fixes: cc833acbee9d ("sg: O_EXCL and other lock handling")
Cc: <stable@vger.kernel.org>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocrypto: padlock-aes - Fix Nano workaround data corruption
Herbert Xu [Fri, 13 Jul 2018 08:12:32 +0000 (16:12 +0800)]
crypto: padlock-aes - Fix Nano workaround data corruption

commit 46d8c4b28652d35dc6cfb5adf7f54e102fc04384 upstream.

This was detected by the self-test thanks to Ard's chunking patch.

I finally got around to testing this out on my ancient Via box.  It
turns out that the workaround got the assembly wrong and we end up
doing count + initial cycles of the loop instead of just count.

This obviously causes corruption, either by overwriting the source
that is yet to be processed, or writing over the end of the buffer.

On CPUs that don't require the workaround only ECB is affected.
On Nano CPUs both ECB and CBC are affected.

This patch fixes it by doing the subtraction prior to the assembly.

Fixes: a76c1c23d0c3 ("crypto: padlock-aes - work around Nano CPU...")
Cc: <stable@vger.kernel.org>
Reported-by: Jamie Heilman <jamie@audible.transient.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agokvm: x86: vmx: fix vpid leak
Roman Kagan [Thu, 19 Jul 2018 18:59:07 +0000 (21:59 +0300)]
kvm: x86: vmx: fix vpid leak

commit 63aff65573d73eb8dda4732ad4ef222dd35e4862 upstream.

VPID for the nested vcpu is allocated at vmx_create_vcpu whenever nested
vmx is turned on with the module parameter.

However, it's only freed if the L1 guest has executed VMXON which is not
a given.

As a result, on a system with nested==on every creation+deletion of an
L1 vcpu without running an L2 guest results in leaking one vpid.  Since
the total number of vpids is limited to 64k, they can eventually get
exhausted, preventing L2 from starting.

Delay allocation of the L2 vpid until VMXON emulation, thus matching its
freeing.

Fixes: 5c614b3583e7b6dab0c86356fa36c2bcbb8322a0
Cc: stable@vger.kernel.org
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agovirtio_balloon: fix another race between migration and ballooning
Jiang Biao [Wed, 18 Jul 2018 02:29:28 +0000 (10:29 +0800)]
virtio_balloon: fix another race between migration and ballooning

commit 89da619bc18d79bca5304724c11d4ba3b67ce2c6 upstream.

Kernel panic when with high memory pressure, calltrace looks like,

PID: 21439 TASK: ffff881be3afedd0 CPU: 16 COMMAND: "java"
 #0 [ffff881ec7ed7630] machine_kexec at ffffffff81059beb
 #1 [ffff881ec7ed7690] __crash_kexec at ffffffff81105942
 #2 [ffff881ec7ed7760] crash_kexec at ffffffff81105a30
 #3 [ffff881ec7ed7778] oops_end at ffffffff816902c8
 #4 [ffff881ec7ed77a0] no_context at ffffffff8167ff46
 #5 [ffff881ec7ed77f0] __bad_area_nosemaphore at ffffffff8167ffdc
 #6 [ffff881ec7ed7838] __node_set at ffffffff81680300
 #7 [ffff881ec7ed7860] __do_page_fault at ffffffff8169320f
 #8 [ffff881ec7ed78c0] do_page_fault at ffffffff816932b5
 #9 [ffff881ec7ed78f0] page_fault at ffffffff8168f4c8
    [exception RIP: _raw_spin_lock_irqsave+47]
    RIP: ffffffff8168edef RSP: ffff881ec7ed79a8 RFLAGS: 00010046
    RAX: 0000000000000246 RBX: ffffea0019740d00 RCX: ffff881ec7ed7fd8
    RDX: 0000000000020000 RSI: 0000000000000016 RDI: 0000000000000008
    RBP: ffff881ec7ed79a8 R8: 0000000000000246 R9: 000000000001a098
    R10: ffff88107ffda000 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000008 R14: ffff881ec7ed7a80 R15: ffff881be3afedd0
    ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018

It happens in the pagefault and results in double pagefault
during compacting pages when memory allocation fails.

Analysed the vmcore, the page leads to second pagefault is corrupted
with _mapcount=-256, but private=0.

It's caused by the race between migration and ballooning, and lock
missing in virtballoon_migratepage() of virtio_balloon driver.
This patch fix the bug.

Fixes: e22504296d4f64f ("virtio_balloon: introduce migration primitives to balloon pages")
Cc: stable@vger.kernel.org
Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Huang Chong <huang.chong@zte.com.cn>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonet: socket: fix potential spectre v1 gadget in socketcall
Jeremy Cline [Fri, 27 Jul 2018 22:43:01 +0000 (22:43 +0000)]
net: socket: fix potential spectre v1 gadget in socketcall

commit c8e8cd579bb4265651df8223730105341e61a2d1 upstream.

'call' is a user-controlled value, so sanitize the array index after the
bounds check to avoid speculating past the bounds of the 'nargs' array.

Found with the help of Smatch:

net/socket.c:2508 __do_sys_socketcall() warn: potential spectre issue
'nargs' [r] (local cap)

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agocan: ems_usb: Fix memory leak on ems_usb_disconnect()
Anton Vasilyev [Fri, 27 Jul 2018 15:50:42 +0000 (18:50 +0300)]
can: ems_usb: Fix memory leak on ems_usb_disconnect()

commit 72c05f32f4a5055c9c8fe889bb6903ec959c0aad upstream.

ems_usb_probe() allocates memory for dev->tx_msg_buffer, but there
is no its deallocation in ems_usb_disconnect().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosquashfs: more metadata hardenings
Linus Torvalds [Thu, 2 Aug 2018 15:43:35 +0000 (08:43 -0700)]
squashfs: more metadata hardenings

commit 71755ee5350b63fb1f283de8561cdb61b47f4d1d upstream.

The squashfs fragment reading code doesn't actually verify that the
fragment is inside the fragment table.  The end result _is_ verified to
be inside the image when actually reading the fragment data, but before
that is done, we may end up taking a page fault because the fragment
table itself might not even exist.

Another report from Anatoly and his endless squashfs image fuzzing.

Reported-by: Анатолий Тросиненко <anatoly.trosinenko@gmail.com>
Acked-by:: Phillip Lougher <phillip.lougher@gmail.com>,
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosquashfs: more metadata hardening
Linus Torvalds [Mon, 30 Jul 2018 21:27:15 +0000 (14:27 -0700)]
squashfs: more metadata hardening

commit d512584780d3e6a7cacb2f482834849453d444a1 upstream.

Anatoly reports another squashfs fuzzing issue, where the decompression
parameters themselves are in a compressed block.

This causes squashfs_read_data() to be called in order to read the
decompression options before the decompression stream having been set
up, making squashfs go sideways.

Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Acked-by: Phillip Lougher <phillip.lougher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonetlink: Fix spectre v1 gadget in netlink_create()
Jeremy Cline [Tue, 31 Jul 2018 21:13:16 +0000 (21:13 +0000)]
netlink: Fix spectre v1 gadget in netlink_create()

[ Upstream commit bc5b6c0b62b932626a135f516a41838c510c6eba ]

'protocol' is a user-controlled value, so sanitize it after the bounds
check to avoid using it for speculative out-of-bounds access to arrays
indexed by it.

This addresses the following accesses detected with the help of smatch:

* net/netlink/af_netlink.c:654 __netlink_create() warn: potential
  spectre issue 'nlk_cb_mutex_keys' [w]

* net/netlink/af_netlink.c:654 __netlink_create() warn: potential
  spectre issue 'nlk_cb_mutex_key_strings' [w]

* net/netlink/af_netlink.c:685 netlink_create() warn: potential spectre
  issue 'nl_table' [w] (local cap)

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonet: dsa: Do not suspend/resume closed slave_dev
Florian Fainelli [Wed, 1 Aug 2018 00:12:52 +0000 (17:12 -0700)]
net: dsa: Do not suspend/resume closed slave_dev

[ Upstream commit a94c689e6c9e72e722f28339e12dff191ee5a265 ]

If a DSA slave network device was previously disabled, there is no need
to suspend or resume it.

Fixes: 2446254915a7 ("net: dsa: allow switch drivers to implement suspend/resume hooks")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoinet: frag: enforce memory limits earlier
Eric Dumazet [Tue, 31 Jul 2018 03:09:11 +0000 (20:09 -0700)]
inet: frag: enforce memory limits earlier

[ Upstream commit 56e2c94f055d328f5f6b0a5c1721cca2f2d4e0a1 ]

We currently check current frags memory usage only when
a new frag queue is created. This allows attackers to first
consume the memory budget (default : 4 MB) creating thousands
of frag queues, then sending tiny skbs to exceed high_thresh
limit by 2 to 3 order of magnitude.

Note that before commit 648700f76b03 ("inet: frags: use rhashtables
for reassembly units"), work queue could be starved under DOS,
getting no cpu cycles.
After commit 648700f76b03, only the per frag queue timer can eventually
remove an incomplete frag queue and its skbs.

Fixes: b13d3cbfb8e8 ("inet: frag: move eviction of queues to work queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jann Horn <jannh@google.com>
Cc: Florian Westphal <fw@strlen.de>
Cc: Peter Oskolkov <posk@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotcp: add one more quick ack after after ECN events
Eric Dumazet [Wed, 27 Jun 2018 15:47:21 +0000 (08:47 -0700)]
tcp: add one more quick ack after after ECN events

[ Upstream commit 15ecbe94a45ef88491ca459b26efdd02f91edb6d ]

Larry Brakmo proposal ( https://patchwork.ozlabs.org/patch/935233/
tcp: force cwnd at least 2 in tcp_cwnd_reduction) made us rethink
about our recent patch removing ~16 quick acks after ECN events.

tcp_enter_quickack_mode(sk, 1) makes sure one immediate ack is sent,
but in the case the sender cwnd was lowered to 1, we do not want
to have a delayed ack for the next packet we will receive.

Fixes: 522040ea5fdd ("tcp: do not aggressively quick ack after ECN events")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Neal Cardwell <ncardwell@google.com>
Cc: Lawrence Brakmo <brakmo@fb.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotcp: refactor tcp_ecn_check_ce to remove sk type cast
Yousuk Seung [Mon, 4 Jun 2018 22:29:51 +0000 (15:29 -0700)]
tcp: refactor tcp_ecn_check_ce to remove sk type cast

[ Upstream commit f4c9f85f3b2cb7669830cd04d0be61192a4d2436 ]

Refactor tcp_ecn_check_ce and __tcp_ecn_check_ce to accept struct sock*
instead of tcp_sock* to clean up type casts. This is a pure refactor
patch.

Signed-off-by: Yousuk Seung <ysseung@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotcp: do not aggressively quick ack after ECN events
Eric Dumazet [Mon, 21 May 2018 22:08:57 +0000 (15:08 -0700)]
tcp: do not aggressively quick ack after ECN events

[ Upstream commit 522040ea5fdd1c33bbf75e1d7c7c0422b96a94ef ]

ECN signals currently forces TCP to enter quickack mode for
up to 16 (TCP_MAX_QUICKACKS) following incoming packets.

We believe this is not needed, and only sending one immediate ack
for the current packet should be enough.

This should reduce the extra load noticed in DCTCP environments,
after congestion events.

This is part 2 of our effort to reduce pure ACK packets.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode
Eric Dumazet [Mon, 21 May 2018 22:08:56 +0000 (15:08 -0700)]
tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode

[ Upstream commit 9a9c9b51e54618861420093ae6e9b50a961914c5 ]

We want to add finer control of the number of ACK packets sent after
ECN events.

This patch is not changing current behavior, it only enables following
change.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agotcp: do not force quickack when receiving out-of-order packets
Eric Dumazet [Thu, 17 May 2018 21:47:25 +0000 (14:47 -0700)]
tcp: do not force quickack when receiving out-of-order packets

[ Upstream commit a3893637e1eb0ef5eb1bbc52b3a8d2dfa317a35d ]

As explained in commit 9f9843a751d0 ("tcp: properly handle stretch
acks in slow start"), TCP stacks have to consider how many packets
are acknowledged in one single ACK, because of GRO, but also
because of ACK compression or losses.

We plan to add SACK compression in the following patch, we
must therefore not call tcp_enter_quickack_mode()

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoNET: stmmac: align DMA stuff to largest cache line length
Eugeniy Paltsev [Thu, 26 Jul 2018 12:05:37 +0000 (15:05 +0300)]
NET: stmmac: align DMA stuff to largest cache line length

[ Upstream commit 9939a46d90c6c76f4533d534dbadfa7b39dc6acc ]

As for today STMMAC_ALIGN macro (which is used to align DMA stuff)
relies on L1 line length (L1_CACHE_BYTES).
This isn't correct in case of system with several cache levels
which might have L1 cache line length smaller than L2 line. This
can lead to sharing one cache line between DMA buffer and other
data, so we can lose this data while invalidate DMA buffer before
DMA transaction.

Fix that by using SMP_CACHE_BYTES instead of L1_CACHE_BYTES for
aligning.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoxen-netfront: wait xenbus state change when load module manually
Xiao Liang [Fri, 27 Jul 2018 09:56:08 +0000 (17:56 +0800)]
xen-netfront: wait xenbus state change when load module manually

[ Upstream commit 822fb18a82abaf4ee7058793d95d340f5dab7bfc ]

When loading module manually, after call xenbus_switch_state to initializes
the state of the netfront device, the driver state did not change so fast
that may lead no dev created in latest kernel. This patch adds wait to make
sure xenbus knows the driver is not in closed/unknown state.

Current state:
[vm]# ethtool eth0
Settings for eth0:
Link detected: yes
[vm]# modprobe -r xen_netfront
[vm]# modprobe  xen_netfront
[vm]# ethtool eth0
Settings for eth0:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
No data available

With the patch installed.
[vm]# ethtool eth0
Settings for eth0:
Link detected: yes
[vm]# modprobe -r xen_netfront
[vm]# modprobe xen_netfront
[vm]# ethtool eth0
Settings for eth0:
Link detected: yes

Signed-off-by: Xiao Liang <xiliang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonet: lan78xx: fix rx handling before first packet is send
Stefan Wahren [Sat, 28 Jul 2018 07:52:10 +0000 (09:52 +0200)]
net: lan78xx: fix rx handling before first packet is send

[ Upstream commit 136f55f660192ce04af091642efc75d85e017364 ]

As long the bh tasklet isn't scheduled once, no packet from the rx path
will be handled. Since the tx path also schedule the same tasklet
this situation only persits until the first packet transmission.
So fix this issue by scheduling the tasklet after link reset.

Link: https://github.com/raspberrypi/linux/issues/2617
Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet")
Suggested-by: Floris Bos <bos@je-eigen-domein.nl>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agonet: fix amd-xgbe flow-control issue
tangpengpeng [Thu, 26 Jul 2018 06:45:16 +0000 (14:45 +0800)]
net: fix amd-xgbe flow-control issue

[ Upstream commit 7f3fc7ddf719cd6faaf787722c511f6918ac6aab ]

If we enable or disable xgbe flow-control by ethtool ,
it does't work.Because the parameter is not properly
assigned,so we need to adjust the assignment order
of the parameters.

Fixes: c1ce2f77366b ("amd-xgbe: Fix flow control setting logic")
Signed-off-by: tangpengpeng <tangpengpeng@higon.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoipv4: remove BUG_ON() from fib_compute_spec_dst
Lorenzo Bianconi [Fri, 27 Jul 2018 16:15:46 +0000 (18:15 +0200)]
ipv4: remove BUG_ON() from fib_compute_spec_dst

[ Upstream commit 9fc12023d6f51551d6ca9ed7e02ecc19d79caf17 ]

Remove BUG_ON() from fib_compute_spec_dst routine and check
in_dev pointer during flowi4 data structure initialization.
fib_compute_spec_dst routine can be run concurrently with device removal
where ip_ptr net_device pointer is set to NULL. This can happen
if userspace enables pkt info on UDP rx socket and the device
is removed while traffic is flowing

Fixes: 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoASoC: pxa: Fix module autoload for platform drivers
Andrea Adami [Fri, 6 May 2016 15:27:34 +0000 (17:27 +0200)]
ASoC: pxa: Fix module autoload for platform drivers

commit e5b7d71aa5b32180adec49a17c752e577c68f740 upstream.

These platform drivers are lacking MODULE_ALIAS so module autoloading
doesn't work. Tested on corgi and poodle with kernel 4.4.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodmaengine: pxa_dma: remove duplicate const qualifier
Eric Engestrom [Mon, 25 Apr 2016 09:47:56 +0000 (10:47 +0100)]
dmaengine: pxa_dma: remove duplicate const qualifier

commit 4e0def887d717598ae8062b46e55f9e00d3a5783 upstream.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoext4: check for allocation block validity with block group locked
Theodore Ts'o [Thu, 12 Jul 2018 23:08:05 +0000 (19:08 -0400)]
ext4: check for allocation block validity with block group locked

commit 8d5a803c6a6ce4ec258e31f76059ea5153ba46ef upstream.

With commit 044e6e3d74a3: "ext4: don't update checksum of new
initialized bitmaps" the buffer valid bit will get set without
actually setting up the checksum for the allocation bitmap, since the
checksum will get calculated once we actually allocate an inode or
block.

If we are doing this, then we need to (re-)check the verified bit
after we take the block group lock.  Otherwise, we could race with
another process reading and verifying the bitmap, which would then
complain about the checksum being invalid.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1780137

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoext4: fix inline data updates with checksums enabled
Theodore Ts'o [Tue, 10 Jul 2018 05:07:43 +0000 (01:07 -0400)]
ext4: fix inline data updates with checksums enabled

commit 362eca70b53389bddf3143fe20f53dcce2cfdf61 upstream.

The inline data code was updating the raw inode directly; this is
problematic since if metadata checksums are enabled,
ext4_mark_inode_dirty() must be called to update the inode's checksum.
In addition, the jbd2 layer requires that get_write_access() be called
before the metadata buffer is modified.  Fix both of these problems.

https://bugzilla.kernel.org/show_bug.cgi?id=200443

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agosquashfs: be more careful about metadata corruption
Linus Torvalds [Sun, 29 Jul 2018 19:44:46 +0000 (12:44 -0700)]
squashfs: be more careful about metadata corruption

commit 01cfb7937a9af2abb1136c7e89fbf3fd92952956 upstream.

Anatoly Trosinenko reports that a corrupted squashfs image can cause a
kernel oops.  It turns out that squashfs can end up being confused about
negative fragment lengths.

The regular squashfs_read_data() does check for negative lengths, but
squashfs_read_metadata() did not, and the fragment size code just
blindly trusted the on-disk value.  Fix both the fragment parsing and
the metadata reading code.

Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agorandom: mix rdrand with entropy sent in from userspace
Theodore Ts'o [Sun, 15 Jul 2018 03:55:57 +0000 (23:55 -0400)]
random: mix rdrand with entropy sent in from userspace

commit 81e69df38e2911b642ec121dec319fad2a4782f3 upstream.

Fedora has integrated the jitter entropy daemon to work around slow
boot problems, especially on VM's that don't support virtio-rng:

    https://bugzilla.redhat.com/show_bug.cgi?id=1572944

It's understandable why they did this, but the Jitter entropy daemon
works fundamentally on the principle: "the CPU microarchitecture is
**so** complicated and we can't figure it out, so it *must* be
random".  Yes, it uses statistical tests to "prove" it is secure, but
AES_ENCRYPT(NSA_KEY, COUNTER++) will also pass statistical tests with
flying colors.

So if RDRAND is available, mix it into entropy submitted from
userspace.  It can't hurt, and if you believe the NSA has backdoored
RDRAND, then they probably have enough details about the Intel
microarchitecture that they can reverse engineer how the Jitter
entropy daemon affects the microarchitecture, and attack its output
stream.  And if RDRAND is in fact an honest DRNG, it will immeasurably
improve on what the Jitter entropy daemon might produce.

This also provides some protection against someone who is able to read
or set the entropy seed file.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>