]> nv-tegra.nvidia Code Review - linux-4.9.git/log
linux-4.9.git
6 years agoarm64: tegra_defconfig: fix duplicated symbol assignment.
Leon Yu [Thu, 8 Nov 2018 03:15:28 +0000 (11:15 +0800)]
arm64: tegra_defconfig: fix duplicated symbol assignment.

Below warning is seen during kernel build:

arch/arm64/configs//tegra_defconfig:8:warning: override: reassigning to symbol IRQ_TIME_ACCOUNTING

It seems to be bad conflict resolution during cherry-picking changes.
This patch removes duplicated IRQ_TIME_ACCOUNTING assignment.

Bug 2049432

Change-Id: Ieca6f6c0e1f21a530f02168f9f76fdfaf92d7bb0
Signed-off-by: Leon Yu <leoyu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1945439
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agosound: soc: dapm: Implement non-recursive DAPM
Niranjan Dighe [Mon, 13 Aug 2018 06:53:23 +0000 (12:23 +0530)]
sound: soc: dapm: Implement non-recursive DAPM

Implement is_connected_ep in a non-recursive way using
two auxiliary stacks and performing a post order traversal
of the DAPM graph.

Jira EMA-1095
Bug 2226733
Bug 200463529

Change-Id: Ia69c284a66c1f26ebf3a95ac8aa3e35a63bd817f
Signed-off-by: Niranjan Dighe <ndighe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1945486
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Uday Gupta <udayg@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch: arm64: configs: update verity key name
Ian Chang [Thu, 1 Nov 2018 08:11:29 +0000 (16:11 +0800)]
arch: arm64: configs: update verity key name

CONFIG_SYSTEM_TRUSTED_KEYS="signing_key.x509"

Bug 200451790

Change-Id: Ie27475a9ae61ae058cfb8522f186ee10428550f4
Signed-off-by: Ian Chang <ianc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1940935
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agort-patches: update patch#68 for hardlockup detector
Kary Jin [Tue, 6 Nov 2018 04:48:02 +0000 (12:48 +0800)]
rt-patches: update patch#68 for hardlockup detector

After applying the patch enabling hardlockup detector
at https://git-master.nvidia.com/r/1934166, there is
a conflict when applying patch#68, like this:

patching file include/linux/printk.h
patching file kernel/printk/printk.c
patching file kernel/watchdog_hld.c
Hunk #1 FAILED at 19.
Hunk #2 succeeded at 198 (offset 94 lines).
Hunk #3 succeeded at 222 (offset 94 lines).
1 out of 3 hunks FAILED -- saving rejects to file
kernel/watchdog_hld.c.rej
make[1]: ***
[/home/buildbrain/Kary-kernel-only/tree/kernel-build/
make/Makefile.kernel:257:
/home/buildbrain/Kary-kernel-only/tree/out/
embedded_aarch64-arm64-tegra_gnu_linux_defconfig-v4m-rt_patches/
kernel/src-rt] Error 1

So this patch update the patch#68 to fix the conflict

Bug 200459527

Change-Id: I0e75e94e1f63170a54c5e73f2f0de89c1f40266a
Signed-off-by: Kary Jin <karyj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1940069
Reviewed-by: Daniel Fu <danifu@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: tegra: enable panic when hard/soft lockup and hung task
Kary Jin [Fri, 26 Oct 2018 03:11:16 +0000 (11:11 +0800)]
arm64: configs: tegra: enable panic when hard/soft lockup and hung task

CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y

Bug 200459527

Change-Id: Ieb098085ada04106ac093a1e82b4977b25c41157
Signed-off-by: Kary Jin <karyj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1937747
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoANDROID: hardlockup: detect hard lockups without NMIs using secondary cpus
Colin Cross [Fri, 12 Oct 2018 07:33:59 +0000 (15:33 +0800)]
ANDROID: hardlockup: detect hard lockups without NMIs using secondary cpus

Emulate NMIs on systems where they are not available by using timer
interrupts on other cpus.  Each cpu will use its softlockup hrtimer
to check that the next cpu is processing hrtimer interrupts by
verifying that a counter is increasing.

This patch is useful on systems where the hardlockup detector is not
available due to a lack of NMIs, for example most ARM SoCs.
Without this patch any cpu stuck with interrupts disabled can
cause a hardware watchdog reset with no debugging information,
but with this patch the kernel can detect the lockup and panic,
which can result in useful debugging info.

Bug 200459527

Change-Id: I83d6837cafcc6d6e7a70352f5a4d09c0ede1d8a4
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Kary Jin <karyj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1929802
(cherry picked from commit c039614dcce22309387769378d722b4c37bd352d)
Reviewed-on: https://git-master.nvidia.com/r/1934166
GVS: Gerrit_Virtual_Submit
Reviewed-by: Daniel Fu <danifu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: tegra: add JOYSTICK_XPAD config
Anuj Gangwar [Fri, 2 Nov 2018 06:14:27 +0000 (11:44 +0530)]
arm64: tegra: add JOYSTICK_XPAD config

enabled: X-Box gamepad support

Bug 2049432

Change-Id: Idd52ede4e8711f9c15d7131aaf3eb71240f2ac4d
Signed-off-by: Anuj Gangwar <anujg@nvidia.com>
(cherry picked from commit c858e3bdb9cd406324dedb75eb424b1291d711b9)

Change-Id: Idd52ede4e8711f9c15d7131aaf3eb71240f2ac4d
Reviewed-on: https://git-master.nvidia.com/r/1943021
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoANDROID: fsnotify: Notify lower fs of open
Daniel Rosenberg [Thu, 1 Nov 2018 08:39:23 +0000 (16:39 +0800)]
ANDROID: fsnotify: Notify lower fs of open

If the filesystem being watched supports d_canonical_path,
notify the lower filesystem of the open as well.

Bug: 70706497
Bug 200451922

Change-Id: I2b1739e068afbaf5eb39950516072bff8345ebfe
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Reviewed-on: https://git-master.nvidia.com/r/1941034
Reviewed-by: Robert Huang (SW-TEGRA) <robhuang@nvidia.com>
Tested-by: Robert Huang (SW-TEGRA) <robhuang@nvidia.com>
Reviewed-by: Eric Zhang (SW-TEGRA) <ericz@nvidia.com>
Tested-by: Eric Zhang (SW-TEGRA) <ericz@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Daniel Fu <danifu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch: arm64: enable CONFIG_UNMAP_KERNEL_AT_EL0
Mustafa Yigit Bilgen [Wed, 10 Oct 2018 23:07:25 +0000 (16:07 -0700)]
arch: arm64: enable CONFIG_UNMAP_KERNEL_AT_EL0

Set CONFIG_UNMAP_KERNEL_AT_EL0=y.

This patch enables KPTI - Kernel Page Table Isolation on Android. This
feature is required for all devices shipping with Android P, regardless
of the susceptibility of the device to speculative side channel attacks.

Bug 2417100

Change-Id: I6dc1dbdae8bf9bc4bcdb3f546c7287ccfe412184
Signed-off-by: Mustafa Yigit Bilgen <mbilgen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1924004
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agodefconfig: Disable CONFIG_CFQ_GROUP_IOSCHED
rkasirajan [Wed, 31 Oct 2018 09:43:46 +0000 (17:43 +0800)]
defconfig: Disable CONFIG_CFQ_GROUP_IOSCHED

Disable CONFIG_CFQ_GROUP_IOSCHED as it affects EMMC and SDcard
performance when docker is enabled.

Bug 200462387

Change-Id: If8722baf9a99d548652e684627d360e4a97cc36e
Signed-off-by: rkasirajan <rkasirajan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1940118
(cherry picked from commit 372476bfa88ec1f637b9760ebf66744a3af9b55a)
Reviewed-on: https://git-master.nvidia.com/r/1941057
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agovideo: fbdev: enable accurate pixel clk on android
Naveen Kumar S [Mon, 22 Oct 2018 07:03:53 +0000 (12:33 +0530)]
video: fbdev: enable accurate pixel clk on android

This change enbales Accurate Pixel Clock feature on Android. This
feature helps in programming the exact pixel clock rate specified
in the standard CEA/VESA modes or in the detailed timings provided
by the sink. The original pixel clock rate is stored and used during
modeset without using the value that was converted between KHz
(specified in EDID or standard mode arrays) and pico seconds (needed
by fbdev), which helps avoid the precision loss caused by this

bug 2045478

Change-Id: Ifedb659429de240ab567c9ebf064b12cec0ffbce
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1932221
(cherry picked from commit e1994d8784c3bbad32c8c587deef119611d70f23)
Reviewed-on: https://git-master.nvidia.com/r/1940192
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agort-patches: rebase rt patches
Ketan Patil [Fri, 26 Oct 2018 08:22:27 +0000 (13:52 +0530)]
rt-patches: rebase rt patches

Minor kernel upgrade to k4.9.135-o with
rt-patches k4.9.115-rt93

Patch Rebased: 305

Bug 200462094

Change-Id: I35d2c943a5beb0332f41e8c636782993e0d45f3b
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1936250
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoMerge "Merge branch 'dev/android-4.9.135-o' into rel-32-4.9" into rel-32-4.9
Gerrit Code Review [Sun, 4 Nov 2018 03:12:18 +0000 (20:12 -0700)]
Merge "Merge branch 'dev/android-4.9.135-o' into rel-32-4.9" into rel-32-4.9

6 years agoinit: modify mount process on diag
Frank Chueh [Fri, 19 Oct 2018 10:49:44 +0000 (18:49 +0800)]
init: modify mount process on diag

When the system-as-root feature is enabled, kernel
uses ramdisk in system partition, it causes Diag
ramdisk (factory_ramdisk) doesn't be mounted.
The change modify kernel mount process to use original
ramdisk when compiling the Diag kerenl.

Bug 200449814

Change-Id: Ibdeead4df720a539b517c3fa95a384c244a514bb
Signed-off-by: Frank Chueh <fchueh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1930595
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Ian Chang <ianc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: Daniel Fu <danifu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agodrivers: allow dvfs to set external vmin to dfll
Martin Gao [Sat, 6 Oct 2018 21:53:25 +0000 (14:53 -0700)]
drivers: allow dvfs to set external vmin to dfll

- added field named external_floor_output in tegra_dfll struct, and API to
  allow dvfs to set Vmin in CLDVFS mode
- added field named joint_rail_with_dfll in dvfs_rail struct, so
  external floor is only enforced on rail connected with dfll
- this feature should only be enabled on merge rail platform, and it's
  controlbed by DT chosen "nvidia,tegra-joint_xpu_rail". Also cc3/cc4
  need to be disabled

Bug 2412305

Change-Id: Ia3995f7a64d768d77bee75014d883118c5334444
Signed-off-by: Martin Gao <marting@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1922563
(cherry picked from commit 1445eaacccde408f39f948811a81d85f37a4ebb9)
Reviewed-on: https://git-master.nvidia.com/r/1940547
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: tegra_android: Added IO Scheduler
Angus Liu [Fri, 12 Oct 2018 18:42:36 +0000 (11:42 -0700)]
arm64: configs: tegra_android: Added IO Scheduler

Enabled Deadline IO scheduler in kernel 4.9

- Deadline IO scheduler is only used by foster_e_hdd
   (set via foster_e_hdd.rc in userspace)
- Prior to Kernel 4.9, Deadline scheduler was enabled,
   when tegra21_defconfig was merged into tegra_android_defconfig,
   deadline scheduler was left out.
- This patch reverts deadline scheduler config to K3.10

bug 2425842

Change-Id: I2e352f6ad8572f584f09da3fe238d220cca15dc9
Signed-off-by: Angus Liu <angusl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1925718
(cherry picked from commit d471c39bc5e07bcbe855f8ada27c6eb760bd6f87)
Reviewed-on: https://git-master.nvidia.com/r/1935625
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agomedia: cx231xx: add decoder to AVerMedia H837
Magdalena Grodzinska [Mon, 27 Aug 2018 21:32:31 +0000 (14:32 -0700)]
media: cx231xx: add decoder to AVerMedia H837

AVerMedia AVerTV Volar Hybrid Q (H837) TV tuner
did not have a decoder module attached.
Add a decoder module in order to create
media controller entity correctly.

Bug 2190055

Change-Id: Iffc48d64421b28df01a68874a6f32d360c1cd12c
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1807733
(cherry picked from commit 8fabf802f088202d8af91fb9745068fbd6937b17)
Reviewed-on: https://git-master.nvidia.com/r/1809392
(cherry picked from commit 8db505a3d6a323c70b9ceefc2525e792f48f308b)
Reviewed-on: https://git-master.nvidia.com/r/1938558
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousbtuner: fix dvb functionality after v4l2 operation
Magdalena Grodzinska [Sat, 25 Aug 2018 01:19:10 +0000 (18:19 -0700)]
usbtuner: fix dvb functionality after v4l2 operation

Cameraserver calls v4l2_open to check the device type as
soon as a v4l2 device is registered, and then v4l2_close
if the device isn't a camera.

For cx231xx tuners, the device needs to stay in DIGITAL_MODE
for dvb_init, however, in v4l2_open the mode is switched to
ANALOG_MODE, which fails dvb_init. This patch fails v4l2_open
if it's called before dvb_init is done for cx231xx tuners.

For em28xx tuners, v4l2_close resets the usb interface alternate
to 0, which is supposed to be 1 for dvb function to work after
dvb_init. This patch skipped the usb interface reset after dvb_init
for em28xx tuners.

This change is applied only to cx231xx tuner.

Bug 1861283
Bug 2190055

Change-Id: I91eb7ae0e171529ed7c0cf0f07404afb33b32d53
Signed-off-by: Jean Huang <jeanh@nvidia.com>
Reviewed-on: http://git-master/r/1313562
(cherry picked from commit 84c023ba8c6ecada48dceeb86c3eaf7ea7806f63)
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806532
(cherry picked from commit b19a0dba6742e0b133c3cc17c2a526dde6182282)
Reviewed-on: https://git-master.nvidia.com/r/1809391
(cherry picked from commit 615e5db2630d409c37712ba68ce7b3c9880f71ac)
Reviewed-on: https://git-master.nvidia.com/r/1938557
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agomedia: cx231xx: bring back PWR_CTL_EN modification
Magdalena Grodzinska [Sat, 25 Aug 2018 00:01:20 +0000 (17:01 -0700)]
media: cx231xx: bring back PWR_CTL_EN modification

Bring back PWR_CTL_EN modification for AVerMedia H837 TV tuner.

This change modifies upstream commit
https://github.com/torvalds/linux/commit/082417d10fafe7be835d143ade7114b5ce26cb50
which removed I2C port 3 switching by modifying PWR_CTL_EN directly.

The AVerMedia tuner requires the switch to work correctly.

Bug 2190055

Change-Id: I849be037261e41b7d99f7234f6686762b8245207
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806531
(cherry picked from commit 811d94cea8be2f61c6ad3c45a14acc2b2f32b151)
Reviewed-on: https://git-master.nvidia.com/r/1809390
(cherry picked from commit e8f6f625da0615884a71159aeecc0e0df15716b5)
Reviewed-on: https://git-master.nvidia.com/r/1938556
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousbtuner: control AVerMedia H837 LED
ManuChen [Mon, 13 Jul 2015 03:14:27 +0000 (11:14 +0800)]
usbtuner: control AVerMedia H837 LED

Bug: 22351873
Bug 1736911
Bug 2190055

Change-Id: If229decccf3279ad3c2179a48cf877d1f1dc0578
Signed-off-by: Jean Huang <jeanh@nvidia.com>
Reviewed-on: http://git-master/r/1311291
(cherry picked from commit 30b0d2f4ab5eec2ce76152c1a99c2dae9a5e160a)
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806530
(cherry picked from commit 50e2c861651cda7fda3556bee80c46bbae75252e)
Reviewed-on: https://git-master.nvidia.com/r/1809389
(cherry picked from commit 1b726263f37bbd3871ef27a5cf966e004204399b)
Reviewed-on: https://git-master.nvidia.com/r/1938555
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousbtuner: fix NPE by unplugging Avermedia tuner device
Terry Heo [Thu, 25 Jun 2015 07:12:09 +0000 (16:12 +0900)]
usbtuner: fix NPE by unplugging Avermedia tuner device

Bug: 21806987
Bug 1736911
Bug 2190055

Change-Id: I519a5c544266ed4a0cdf01a84f510629d5ec41ed
Signed-off-by: Terry Heo <terryheo@google.com>
Reviewed-on: http://git-master/r/1311290
(cherry picked from commit 9f6dc884345e1c6fab01fa62d013d8c43e00457f)
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806529
(cherry picked from commit e15070f05abc532b172a1d58ea0676d4939003ba)
Reviewed-on: https://git-master.nvidia.com/r/1809388
(cherry picked from commit 6f40f844a5e7c3f01ea3998232717cc31dffb010)
Reviewed-on: https://git-master.nvidia.com/r/1938554
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousbtuner: add AVerMedia H837 support
Terry Heo [Thu, 7 May 2015 02:17:38 +0000 (11:17 +0900)]
usbtuner: add AVerMedia H837 support

Add support for TDA18272 tuner module and
AVerMedia AVerTV Volar Hybrid Q (H837) USB TV tuner.

Resolved style issues from original commit and
DVB frontend API issues for TDA18272.

Bug: 20649732
Bug 1736911
Bug 2190055
Bug 2363907

Change-Id: Ib550504231ba2eaedebb864295db50069ebe769c
Signed-off-by: Terry Heo <terryheo@google.com>
Reviewed-on: http://git-master/r/1311288
(cherry picked from commit 8240d550519c4b97e8c97efcf646439fce40a9a0)
Signed-off-by: Magdalena Grodzinska <mgrodzinska@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1806528
(cherry picked from commit 19e5815c62e99b0dbcfa51989af2ee69c14311a4)
Reviewed-on: https://git-master.nvidia.com/r/1809387
(cherry picked from commit 3616efb8d342001e30c8bb337fc61b0128103165)
Reviewed-on: https://git-master.nvidia.com/r/1938553
Tested-by: Vladislav Zhurba <vzhurba@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agodefconfig: Enable BMI160 IMU
Robert Collins [Tue, 16 Oct 2018 22:33:37 +0000 (15:33 -0700)]
defconfig: Enable BMI160 IMU

- BMI160 IMU is disabled by default.  Enable it.

Bug 2341764

Change-Id: Idff22628a4899d8744bcd6345aee20ab9fafb82e
Signed-off-by: Robert Collins <rcollins@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1804811
(cherry picked from commit 4a177585a8b6b4ad874a2df0643b84866a486e46)
Reviewed-on: https://git-master.nvidia.com/r/1928467
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agotegra21: emc: Only poll single rank for PD
Alex Waterman [Wed, 24 Oct 2018 08:22:28 +0000 (16:22 +0800)]
tegra21: emc: Only poll single rank for PD

Only poll the single active rank for power-down status when checking if
the DRAM has left auto power-down state and there's only a single rank
of DRAM.

Bug 1906919

Change-Id: I5bc8c926e03268785425b337780e5720414342de
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1471775
(cherry picked from commit fdb38b913a0eda8dbb545528192e542fcdd37199)
Reviewed-on: https://git-master.nvidia.com/r/1934345
(cherry picked from commit 6ee8c4091545e7917e8cde7e0f37849517a3a30e)
Reviewed-on: https://git-master.nvidia.com/r/1935485
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: enable BCMDHD custom config
Om [Wed, 26 Sep 2018 11:16:36 +0000 (16:46 +0530)]
arm64: configs: enable BCMDHD custom config

enable below config

CONFIG_BCMDHD_CUSTOM_NET_PERF_TEGRA=y
CONFIG_BCMDHD_CUSTOM_NET_BW_EST_TEGRA=y
CONFIG_BCMDHD_CUSTOM_NET_DIAG_TEGRA=y

Bug 200448506

Change-Id: I66cd7509186492883618a77c6d922a2c4d0c5079
Reviewed-on: https://git-master.nvidia.com/r/1923615
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agotegra: fuse: add redundant AID WAR support
Daniel Fu [Fri, 28 Sep 2018 08:49:34 +0000 (16:49 +0800)]
tegra: fuse: add redundant AID WAR support

Kernel v3.10 assumed AID fuse as redundant.
This is a WAR to align with legacy kernel and clients
for reading the same value.

Bug 200414304

Change-Id: I35a83f1372c060ed5449c7b4884395b888cc27c4
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1850902
(cherry picked from commit 3b1bead2ab980d28f85397d89b3053f2e053f433)
Reviewed-on: https://git-master.nvidia.com/r/1935041
Reviewed-by: Mihir Joshi <mihirj@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch: arm64: configs: enable CONFIG_F2FS_FS
Ian Chang [Wed, 24 Oct 2018 05:02:45 +0000 (22:02 -0700)]
arch: arm64: configs: enable CONFIG_F2FS_FS

CONFIG_F2FS_FS=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_FS_ENCRYPTION=y

Bug 200457703

Change-Id: Idbe8f4636ccde7ae160c809ab23c49729293fdb5
Reviewed-on: https://git-master.nvidia.com/r/1934169
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: enable IRQ_TIME_ACCOUNTING
Bibek Basu [Wed, 10 Oct 2018 10:03:58 +0000 (15:33 +0530)]
arm64: configs: enable IRQ_TIME_ACCOUNTING

Enable CONFIG_IRQ_TIME_ACCOUNTING for Android defconfig. This is
needed by load balancing so that the time servicing IRQ can be
considered when calculating rt average.

Bug 200444222

Change-Id: I8a1fc1aac608620307bf43122a53059adfe6053c
Reviewed-on: https://git-master.nvidia.com/r/1923445
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
(cherry picked from commit 246d77efeae7fbf817daeb521ebd97459d054b95)
Reviewed-on: https://git-master.nvidia.com/r/1924400
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoMerge branch 'dev/android-4.9.135-o' into rel-32-4.9
Ketan Patil [Mon, 29 Oct 2018 08:12:22 +0000 (13:42 +0530)]
Merge branch 'dev/android-4.9.135-o' into rel-32-4.9

Minor Kernel upgrade from K4.9.129-o to K4.9.135-o

Bug 200462094

Resolved Conflicts:
drivers/hid/hid-core.c
drivers/hid/hid-sony.c

Change-Id: Ibd9cc4d062eee5df9944fc5fe30d4eb68d98031b
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
6 years agoRevert "media: v4l: event: Prevent freeing event subscriptions while accessed"
Ketan Patil [Mon, 29 Oct 2018 07:59:59 +0000 (13:29 +0530)]
Revert "media: v4l: event: Prevent freeing event subscriptions while accessed"

This reverts commit ec964c3c00457e7ce6b633a33d1c6b61e0091557.

6 years agodma-engine: tegra210-adma: free dma controller
spujar [Fri, 28 Sep 2018 10:52:10 +0000 (16:22 +0530)]
dma-engine: tegra210-adma: free dma controller

Following kernel panic is seen when DMA driver is loaded again
after removal.
===============================================================================
Unable to handle kernel paging request at virtual address ffffff8001198880
Internal error: Oops: 86000007 [#1] PREEMPT SMP
CPU: 0 PID: 5907 Comm: HwBinder:4123_1 Tainted: G C 4.9.128-tegra-g065839f #11
Hardware name: galen (DT)
task: ffffffc3590d1a80 task.stack: ffffffc3d0678000
PC is at 0xffffff8001198880
LR is at of_dma_request_slave_channel+0xd8/0x1f8
pc : [<ffffff8001198880>] lr : [<ffffff8008746f30>] pstate: 60400045
sp : ffffffc3d067b710
x29: ffffffc3d067b710 x28: 000000000000002f
x27: ffffff800949e000 x26: ffffff800949e750
x25: ffffff800949e000 x24: ffffffbefe817d84
x23: ffffff8009f77cb0 x22: 0000000000000028
x21: ffffffc3ffda49c8 x20: 0000000000000029
x19: 0000000000000001 x18: ffffffffffffffff
x17: 0000000000000000 x16: ffffff80082b66a0
x15: ffffff8009e78250 x14: 000000000000000a
x13: 0000000000000038 x12: 0101010101010101
x11: 0000000000000030 x10: 0101010101010101
x9 : fffffffffffffffc x8 : 7f7f7f7f7f7f7f7f
x7 : 62ff726b6b64622c x6 : 0000000000008064
x5 : 6400000000000000 x4 : ffffffbefe817c44
x3 : ffffffc3ffda3e08 x2 : ffffff8001198880
x1 : ffffffc3d48323c0 x0 : ffffffc3d067b788

Process HwBinder:4123_1 (pid: 5907, stack limit = 0xffffffc3d0678028)
Call trace:
[<ffffff8001198880>] 0xffffff8001198880
[<ffffff80087459f8>] dma_request_chan+0x50/0x1f0
[<ffffff8008745bc0>] dma_request_slave_channel+0x28/0x40
[<ffffff8001552c44>] tegra_alt_pcm_open+0x114/0x170 [snd_soc_tegra_alt_utils]
[<ffffff8008d65fa4>] soc_pcm_open+0x10c/0x878
[<ffffff8008d18618>] snd_pcm_open_substream+0xc0/0x170
[<ffffff8008d1878c>] snd_pcm_open+0xc4/0x240
[<ffffff8008d189e0>] snd_pcm_playback_open+0x58/0x80
[<ffffff8008cfc6d4>] snd_open+0xb4/0x178
[<ffffff8008250628>] chrdev_open+0xb8/0x1d0
[<ffffff8008246fdc>] do_dentry_open+0x214/0x318
[<ffffff80082485d0>] vfs_open+0x58/0x88
[<ffffff800825bce0>] do_last+0x450/0xde0
[<ffffff800825c718>] path_openat+0xa8/0x368
[<ffffff800825dd84>] do_filp_open+0x8c/0x110
[<ffffff8008248a74>] do_sys_open+0x164/0x220
[<ffffff80082b66dc>] compat_SyS_openat+0x3c/0x50
[<ffffff8008083040>] el0_svc_naked+0x34/0x38
---[ end trace 67e6d544e65b5145 ]---
Kernel panic - not syncing: Fatal exception
===============================================================================

The issue happens because in probe(), DMA controller is registed with DT DMA
helpers and the same is not freed during driver remove. During loading again
this results in memory abort and kernel panic happens.

This patch frees up resources with of_dma_controller_free() call in driver
remove.

Bug 200453666

Change-Id: I904b8f7d35b8e1fa16ec92764a48af84725f2bc0
Signed-off-by: spujar <spujar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1851029
(cherry picked from commit 9e1270748244d375296eae9f16e23ee146d71bf0)
Reviewed-on: https://git-master.nvidia.com/r/1935134
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agocifs: report reconnect error to userspace
Robert Shih [Tue, 26 Jun 2018 05:38:21 +0000 (13:38 +0800)]
cifs: report reconnect error to userspace

Bug 2194577

Change-Id: Iec3d9dde7ad3abb1daa80df0eb9f84e5474722e8
Signed-off-by: Robert Shih <rshih@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1761297
Reviewed-on: https://git-master.nvidia.com/r/1851180
Reviewed-on: https://git-master.nvidia.com/r/1934988
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shawn Heo <sheo@nvidia.com>
Tested-by: Shawn Heo <sheo@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agocifs: add sysfs support to deliver uevent to userspace
Jean Huang [Tue, 20 Mar 2018 05:22:32 +0000 (22:22 -0700)]
cifs: add sysfs support to deliver uevent to userspace

We need more detailed SMB status in userspace to help
users to be aware of NAS status, including failure.

Bug 200396506

Change-Id: I50e1a2c7a4b83b6b3ad006f4f6b34c4080f28fb6
Signed-off-by: Jean Huang <jeanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1679077
(cherry picked from commit dcd8b224377915bcc3112c9704f43965e283518b)
Reviewed-on: https://git-master.nvidia.com/r/1850588
(cherry picked from commit 256fe4883b246c27c7f62dfbaf211aeee49c27db)
Reviewed-on: https://git-master.nvidia.com/r/1934987
GVS: Gerrit_Virtual_Submit
Reviewed-by: Shawn Heo <sheo@nvidia.com>
Tested-by: Shawn Heo <sheo@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: tegra: Build CAN drivers as LKMs
Nicolin Chen [Tue, 11 Sep 2018 21:41:04 +0000 (14:41 -0700)]
arm64: configs: tegra: Build CAN drivers as LKMs

The following configs are enabled to support CAN:
  CONFIG_CAN
  CONFIG_CAN_VCAN
  CONFIG_CAN_SLCAN
  CONFIG_CAN_PEAK_PCIEFD
  CONFIG_MTTCAN
  CONFIG_TEGRA_HV_SECCAN

However, not all platforms would need CAN support, especially both
MTTCAN and TEGRA_HV_SECCAN depend on ARCH_TEGRA_18x_SOC, so these
could be just skipped for older SoCs, e.g. ARCH_TEGRA_210_SOC.

This patch changes all CAN configs to =m to build them as LKMs.

Bug 200428570
Bug 2284925

Change-Id: If6899fac19876b84adec70c64657441163de111b
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1820605
(cherry picked from commit fb39a231b428699d4a62c329fdc2bca455908dbb)
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1933435
(cherry picked from commit 191c4e9ea0e53e160004527ad525c370041271d3)
Reviewed-on: https://git-master.nvidia.com/r/1934734
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch: arm64: configs: enable CONFIG_SECTION_MISMATCH_WARN_ONLY
Hayden Du [Tue, 23 Oct 2018 05:13:54 +0000 (13:13 +0800)]
arch: arm64: configs: enable CONFIG_SECTION_MISMATCH_WARN_ONLY

enable CONFIG_SECTION_MISMATCH_WARN_ONLY to fix code coverage
build failure.

Bug 200457465

Change-Id: Icad0493c5ccbfccad31a44e3a11be5f9ff4f1cf3
Signed-off-by: Hayden Du <haydend@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1933259
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousb: Make usb_suspend_both print
Nat Pettipaw [Wed, 10 Oct 2018 22:43:49 +0000 (15:43 -0700)]
usb: Make usb_suspend_both print

We want to see prints from USB suspending to ensure whether
or not drives are actually suspending.

Bug 2098768

Change-Id: Iefa3b675f3c6887c462795c6c472994796d8d3ae
Reviewed-on: https://git-master.nvidia.com/r/1923990
(cherry picked from commit a79781fe847b20625d2ce6affb4b5870b63e0485)
Reviewed-on: https://git-master.nvidia.com/r/1933808
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nat Pettipaw <npettipaw@nvidia.com>
Tested-by: Nat Pettipaw <npettipaw@nvidia.com>
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoRevert "arm64: configs: disable ANDROID_LOW_MEMORY_KILLER"
Gagan Grover [Tue, 23 Oct 2018 05:24:50 +0000 (22:24 -0700)]
Revert "arm64: configs: disable ANDROID_LOW_MEMORY_KILLER"

This reverts commit a002918ad023f15c708064aca5f9c38db03dc525.

VTS needs ANDROID_LOW_MEMORY_KILLER config enabled.

Bug 200453907

Change-Id: I34bf43ac81f48d56c0c28da8129e25d86bec81cb
Reviewed-on: https://git-master.nvidia.com/r/1933266
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agovideo: fbdev: add support for storing pixclk in hz
Naveen Kumar S [Mon, 27 Aug 2018 06:42:17 +0000 (12:12 +0530)]
video: fbdev: add support for storing pixclk in hz

fbdev framework stores pixelclock in pico seconds. Since monitors
advertize pixclock in hz, we need to convert it from Hz to pico
seconds when creating mode database. During modeset, it again needs
to be converted back to Hz. These conversions cause precision loss,
because of which the final pixclock value does not match the original
value advertized by the sink.

This issue is prominently seen in case of non-CEA modes.

Most of the monitors handle this slight variation in pixclock without
complaining. But, there are a few monitors that fail when the exact
pixclock is not programmed. Hence, interoperability is affected.

Avoiding the pixclock conversion helps in avoiding the precision loss
issue. But, the idea of updating the core kernel fbdev driver to use
pixel clock in hz intead of pico seconds was rejected because it might
cause ABI compatibility issues.

The finalized solution is to store the original pixclock in hz along
with the pixclock in pico seconds, and use the hz pixclock during
modeset instead of the converted one.

Implementation Details:

fb_var_screeninfo is the  structure used by userspace clients to specify
their chosen mode timings to kernel. To avoid breaking the current fbdev
ABI, we avoided making any changes to this structure.

A new variable, pixclock_hz, has been added to the existing fb_videomode
structure. It is used to store the original pixclock value in hz during
mode database creation. As part of modeset, this value is used instead of
the one that went through conversion between hz and pico seconds. This
in-turn helps in setting accurate pixel clock advertized by sinks.

New defconfig option introduced:

To make it easy to enable/disable this feature, the whole implementation
has been wrapped under a new defconfig option, CONFIG_FB_MODE_PIXCLOCK_HZ.
Any updates to existing data structures has also been isolated under this
defconfig option.

bug 2045478

Change-Id: Id3ef39a0d50beee95b9eaba32afa65a7aa28c53a
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1812545
(cherry picked from commit 09877297e4f43aa8844c009a6a30c70033ac664e)
Reviewed-on: https://git-master.nvidia.com/r/1932350
GVS: Gerrit_Virtual_Submit
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch64: config: enable virtual tunnel interface config
Om [Wed, 17 Oct 2018 21:33:39 +0000 (03:03 +0530)]
arch64: config: enable virtual tunnel interface config

enable virtual tunnel interface config for netd_integration_test

Bug 200457259

Change-Id: I9d3083953e62fad256fde7ca2010187ba9411b27
Signed-off-by: Om <omp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1923851
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: configs: enable SCSI_PROC_FS for tegra
Vincent Zhang [Fri, 19 Oct 2018 02:40:29 +0000 (10:40 +0800)]
arm64: configs: enable SCSI_PROC_FS for tegra

Enabling CONFIG_SCSI_PROC_FS as this is required for uncrypt

Bug 200457778

Change-Id: I1f418efd872ce23bb4cc64247c491c2a2232c0f9
Signed-off-by: Vincent Zhang <xunz@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1930388
(cherry picked from commit 61f8440be465b915f835cc1800037f12d0454a57)
Reviewed-on: https://git-master.nvidia.com/r/1933265
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agokernel/sched: Fix up 4.9.135 merge
Nathan Chancellor [Mon, 22 Oct 2018 04:43:09 +0000 (21:43 -0700)]
kernel/sched: Fix up 4.9.135 merge

Commit aee0c9e837c2 ("sched/cputime: Fix ksoftirqd cputime accounting
regression") moved the calls to u64_stats_update_{begin,end} from
irqtime_account_irq into irqtime_account_delta. This was missed in
commit 03fcc2fe7130 ("Merge 4.9.135 into android-4.9"), which only
removed the u64_stats_update_begin call in irqtime_account_irq, because
of a conflict with commit 3a73c96a286f ("ANDROID: sched/walt: Accounting
for number of irqs pending on each core").

Since the two code blocks above and below this statement were gated by
CONFIG_SCHED_WALT, combine them into one at the same time.

Change-Id: I25e9e5a2f063f8df53fa4ff2cfc26dced6ec2b02
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
6 years agommc: host: Add speed class in debugfs
Aniruddha Rao [Wed, 17 Oct 2018 08:43:57 +0000 (01:43 -0700)]
mmc: host: Add speed class in debugfs

Add support in debugfs to identify speed class of
SD cards.

Bug 2420580

Change-Id: I9f869aa639f5acec80bea5ba56b82974e96a7a91
Signed-off-by: Aniruddha Rao <anrao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928864
(cherry picked from commit b4c433d578faff4eb72451a444fd9dfc27489041)
Reviewed-on: https://git-master.nvidia.com/r/1932065
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agousb: typec: include linux/device.h in ucsi.h
Arnd Bergmann [Fri, 30 Jun 2017 15:46:16 +0000 (17:46 +0200)]
usb: typec: include linux/device.h in ucsi.h

The new driver causes a build failure in some configurations:

In file included from /git/arm-soc/drivers/usb/typec/ucsi/trace.h:9:0,
                 from /git/arm-soc/drivers/usb/typec/ucsi/trace.c:2:
drivers/usb/typec/ucsi/ucsi.h:331:39: error: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]

This includes the required header file.

Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug 2284925

Change-Id: I0c3625c9021bfa9425691e47d9d8f788697d0a10
(cherry picked from commit 86be7f7b2d940ddc18143061e77989b017d93bf8)
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928285
(cherry picked from commit 8a6fe2878be58c8c25300297bfe652b958b296e9)
Reviewed-on: https://git-master.nvidia.com/r/1928614
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agopower: extcon: add ac adaptor cable to psy cables
Venkat Reddy Talla [Wed, 3 Oct 2018 11:41:27 +0000 (17:11 +0530)]
power: extcon: add ac adaptor cable to psy cables

Adding ac adaptor cable id to power supply cables to
report always on external ac adaptor power supply
status to framework layer.

Bug 200453496

Change-Id: I01770b76da138a1ba04a364f09a51b7ed755ead2
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1922473
(cherry picked from commit 299323f2a7215342940a8e78d29a78a0ebaa8609)
Reviewed-on: https://git-master.nvidia.com/r/1928119
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Xianhui Wang <xianhuiw@nvidia.com>
Tested-by: Xianhui Wang <xianhuiw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoextcon: add unique ac adaptor extcon cable id
Venkat Reddy Talla [Wed, 3 Oct 2018 11:43:49 +0000 (17:13 +0530)]
extcon: add unique ac adaptor extcon cable id

Add unique ac adaptor extcon cable id, this cable
id used to detect and report always on ac power supply
status to framework layer.

Bug 200453496

Change-Id: Ibeb6b25e0db2aed35bbed7389245fb07125378af
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1922472
(cherry picked from commit 958ce629d61bb2207cb8505b5cf9f5a254153938)
Reviewed-on: https://git-master.nvidia.com/r/1928117
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Xianhui Wang <xianhuiw@nvidia.com>
Tested-by: Xianhui Wang <xianhuiw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoMerge 4.9.135 into android-4.9-o
Greg Kroah-Hartman [Sat, 20 Oct 2018 12:55:54 +0000 (14:55 +0200)]
Merge 4.9.135 into android-4.9-o

Changes in 4.9.135
media: af9035: prevent buffer overflow on write
batman-adv: Fix segfault when writing to throughput_override
batman-adv: Fix segfault when writing to sysfs elp_interval
batman-adv: Prevent duplicated nc_node entry
batman-adv: Prevent duplicated softif_vlan entry
batman-adv: Prevent duplicated global TT entry
batman-adv: Prevent duplicated tvlv handler
batman-adv: fix backbone_gw refcount on queue_work() failure
batman-adv: fix hardif_neigh refcount on queue_work() failure
clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs
scsi: ibmvscsis: Fix a stringop-overflow warning
scsi: ibmvscsis: Ensure partition name is properly NUL terminated
Input: atakbd - fix Atari keymap
Input: atakbd - fix Atari CapsLock behaviour
ravb: do not write 1 to reserved bits
drm: mali-dp: Call drm_crtc_vblank_reset on device init
scsi: sd: don't crash the host on invalid commands
net/mlx4: Use cpumask_available for eq->affinity_mask
powerpc/tm: Fix userspace r13 corruption
powerpc/tm: Avoid possible userspace r1 corruption on reclaim
iommu/amd: Return devid as alias for ACPI HID devices
mremap: properly flush TLB before releasing the page
mm: Preserve _PAGE_DEVMAP across mprotect() calls
netfilter: check for seqadj ext existence before adding it in nf_nat_setup_info
ARC: build: Get rid of toolchain check
ARC: build: Don't set CROSS_COMPILE in arch's Makefile
HID: quirks: fix support for Apple Magic Keyboards
usb: gadget: serial: fix oops when data rx'd after close
sched/cputime: Convert kcpustat to nsecs
macintosh/rack-meter: Convert cputime64_t use to u64
sched/cputime: Increment kcpustat directly on irqtime account
sched/cputime: Fix ksoftirqd cputime accounting regression
ext4: avoid running out of journal credits when appending to an inline file
HV: properly delay KVP packets when negotiation is in progress
Linux 4.9.135

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
6 years agoLinux 4.9.135
Greg Kroah-Hartman [Sat, 20 Oct 2018 07:51:33 +0000 (09:51 +0200)]
Linux 4.9.135

6 years agoHV: properly delay KVP packets when negotiation is in progress
Long Li [Sun, 30 Apr 2017 23:21:19 +0000 (16:21 -0700)]
HV: properly delay KVP packets when negotiation is in progress

commit a3ade8cc474d848676278660e65f5af1e9e094d9 upstream.

The host may send multiple negotiation packets
(due to timeout) before the KVP user-mode daemon
is connected. KVP user-mode daemon is connected.
We need to defer processing those packets
until the daemon is negotiated and connected.
It's okay for guest to respond
to all negotiation packets.

In addition, the host may send multiple staged
KVP requests as soon as negotiation is done.
We need to properly process those packets using one
tasklet for exclusive access to ring buffer.

This patch is based on the work of
Nick Meier <Nick.Meier@microsoft.com>.

The above is the original changelog of
a3ade8cc474d ("HV: properly delay KVP packets when negotiation is in progress"

Here I re-worked the original patch because the mainline version
can't work for the linux-4.4.y branch, on which channel->callback_event
doesn't exist yet. In the mainline, channel->callback_event was added by:
631e63a9f346 ("vmbus: change to per channel tasklet"). Here we don't want
to backport it to v4.4, as it requires extra supporting changes and fixes,
which are unnecessary as to the KVP bug we're trying to resolve.

NOTE: before this patch is used, we should cherry-pick the other related
3 patches from the mainline first:

The background of this backport request is that: recently Wang Jian reported
some KVP issues: https://github.com/LIS/lis-next/issues/593:
e.g. the /var/lib/hyperv/.kvp_pool_* files can not be updated, and sometimes
if the hv_kvp_daemon doesn't timely start, the host may not be able to query
the VM's IP address via KVP.

Reported-by: Wang Jian <jianjian.wang1@gmail.com>
Tested-by: Wang Jian <jianjian.wang1@gmail.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoext4: avoid running out of journal credits when appending to an inline file
Theodore Ts'o [Sun, 17 Jun 2018 03:41:59 +0000 (23:41 -0400)]
ext4: avoid running out of journal credits when appending to an inline file

commit 8bc1379b82b8e809eef77a9fedbb75c6c297be19 upstream.

Use a separate journal transaction if it turns out that we need to
convert an inline file to use an data block.  Otherwise we could end
up failing due to not having journal credits.

This addresses CVE-2018-10883.

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
[fengc@google.com: 4.4 and 4.9 backport: adjust context]
Signed-off-by: Chenbo Feng <fengc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agosched/cputime: Fix ksoftirqd cputime accounting regression
Frederic Weisbecker [Tue, 25 Apr 2017 14:10:48 +0000 (16:10 +0200)]
sched/cputime: Fix ksoftirqd cputime accounting regression

commit 25e2d8c1b9e327ed260edd13169cc22bc7a78bc6 upstream.

irq_time_read() returns the irqtime minus the ksoftirqd time. This
is necessary because irq_time_read() is used to substract the IRQ time
from the sum_exec_runtime of a task. If we were to include the softirq
time of ksoftirqd, this task would substract its own CPU time everytime
it updates ksoftirqd->sum_exec_runtime which would therefore never
progress.

But this behaviour got broken by:

  a499a5a14db ("sched/cputime: Increment kcpustat directly on irqtime account")

... which now includes ksoftirqd softirq time in the time returned by
irq_time_read().

This has resulted in wrong ksoftirqd cputime reported to userspace
through /proc/stat and thus "top" not showing ksoftirqd when it should
after intense networking load.

ksoftirqd->stime happens to be correct but it gets scaled down by
sum_exec_runtime through task_cputime_adjusted().

To fix this, just account the strict IRQ time in a separate counter and
use it to report the IRQ time.

Reported-and-tested-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1493129448-5356-1-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agosched/cputime: Increment kcpustat directly on irqtime account
Frederic Weisbecker [Tue, 31 Jan 2017 03:09:32 +0000 (04:09 +0100)]
sched/cputime: Increment kcpustat directly on irqtime account

commit a499a5a14dbd1d0315a96fc62a8798059325e9e6 upstream.

The irqtime is accounted is nsecs and stored in
cpu_irq_time.hardirq_time and cpu_irq_time.softirq_time. Once the
accumulated amount reaches a new jiffy, this one gets accounted to the
kcpustat.

This was necessary when kcpustat was stored in cputime_t, which could at
worst have jiffies granularity. But now kcpustat is stored in nsecs
so this whole discretization game with temporary irqtime storage has
become unnecessary.

We can now directly account the irqtime to the kcpustat.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-17-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomacintosh/rack-meter: Convert cputime64_t use to u64
Frederic Weisbecker [Tue, 31 Jan 2017 03:09:20 +0000 (04:09 +0100)]
macintosh/rack-meter: Convert cputime64_t use to u64

commit 564b733c899f4e12a64946658960fce80cad0b05 upstream.

cputime_t is going to be removed and replaced by nsecs units,
so convert the drivers/macintosh/rack-meter.c use to u64..

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-5-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agosched/cputime: Convert kcpustat to nsecs
Frederic Weisbecker [Tue, 31 Jan 2017 03:09:19 +0000 (04:09 +0100)]
sched/cputime: Convert kcpustat to nsecs

commit 7fb1327ee9b92fca27662f9b9d60c7c3376d6c69 upstream.

Kernel CPU stats are stored in cputime_t which is an architecture
defined type, and hence a bit opaque and requiring accessors and mutators
for any operation.

Converting them to nsecs simplifies the code and is one step toward
the removal of cputime_t in the core code.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1485832191-26889-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[colona: minor conflict as 527b0a76f41d ("sched/cpuacct: Avoid %lld seq_printf
 warning") is missing from v4.9]
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: gadget: serial: fix oops when data rx'd after close
Stephen Warren [Wed, 16 Aug 2017 20:30:10 +0000 (14:30 -0600)]
usb: gadget: serial: fix oops when data rx'd after close

commit daa35bd95634a2a2d72d1049c93576a02711cb1a upstream.

When the gadget serial device has no associated TTY, do not pass any
received data into the TTY layer for processing; simply drop it instead.
This prevents the TTY layer from calling back into the gadget serial
driver, which will then crash in e.g. gs_write_room() due to lack of
gadget serial device to TTY association (i.e. a NULL pointer dereference).

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoHID: quirks: fix support for Apple Magic Keyboards
Natanael Copa [Thu, 18 Oct 2018 15:04:17 +0000 (17:04 +0200)]
HID: quirks: fix support for Apple Magic Keyboards

Commit b6cc0ba2cbf4 (HID: add support for Apple Magic Keyboards)
backported support for the Magic Keyboard over Bluetooth, but did not
add the BT_VENDOR_ID_APPLE to hid_have_special_driver[] so the hid-apple
driver is never loaded and Fn key does not work at all.

Adding BT_VENDOR_ID_APPLE to hid_have_special_driver[] is not needed
after commit e04a0442d33b (HID: core: remove the absolute need of
hid_have_special_driver[]), so 4.16 kernels and newer does not need it.

Fixes: b6cc0ba2cbf4 (HID: add support for Apple Magic Keyboards)
Bugzilla-id: https://bugzilla.kernel.org/show_bug.cgi?id=99881
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoARC: build: Don't set CROSS_COMPILE in arch's Makefile
Alexey Brodkin [Sun, 16 Sep 2018 20:47:57 +0000 (23:47 +0300)]
ARC: build: Don't set CROSS_COMPILE in arch's Makefile

commit 40660f1fcee8d524a60b5101538e42b1f39f106d upstream.

There's not much sense in doing that because if user or
his build-system didn't set CROSS_COMPILE we still may
very well make incorrect guess.

But as it turned out setting CROSS_COMPILE is not as harmless
as one may think: with recent changes that implemented automatic
discovery of __host__ gcc features unconditional setup of
CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
with absent cross-compiler, for more info see [1].

Set CROSS_COMPILE as well gets in the way if we want only to build
.dtb's (again with absent cross-compiler which is not really needed
for building .dtb's), see [2].

Note, we had to change LIBGCC assignment type from ":=" to "="
so that is is resolved on its usage, otherwise if it is resolved
at declaration time with missing CROSS_COMPILE we're getting this
error message from host GCC:

| gcc: error: unrecognized command line option -mmedium-calls
| gcc: error: unrecognized command line option -mno-sdata

[1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
[2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoARC: build: Get rid of toolchain check
Alexey Brodkin [Thu, 13 Sep 2018 20:24:28 +0000 (23:24 +0300)]
ARC: build: Get rid of toolchain check

commit 615f64458ad890ef94abc879a66d8b27236e733a upstream.

This check is very naive: we simply test if GCC invoked without
"-mcpu=XXX" has ARC700 define set. In that case we think that GCC
was built with "--with-cpu=arc700" and has libgcc built for ARC700.

Otherwise if ARC700 is not defined we think that everythng was built
for ARCv2.

But in reality our life is much more interesting.

1. Regardless of GCC configuration (i.e. what we pass in "--with-cpu"
   it may generate code for any ARC core).

2. libgcc might be built with explicitly specified "--mcpu=YYY"

That's exactly what happens in case of multilibbed toolchains:
 - GCC is configured with default settings
 - All the libs built for many different CPU flavors

I.e. that check gets in the way of usage of multilibbed
toolchains. And even non-multilibbed toolchains are affected.
OpenEmbedded also builds GCC without "--with-cpu" because
each and every target component later is compiled with explicitly
set "-mcpu=ZZZ".

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agonetfilter: check for seqadj ext existence before adding it in nf_nat_setup_info
Xin Long [Thu, 10 Aug 2017 02:22:24 +0000 (10:22 +0800)]
netfilter: check for seqadj ext existence before adding it in nf_nat_setup_info

commit ab6dd1beac7be3c17f8bf3d38bdf29ecb7293f1e upstream.

Commit 4440a2ab3b9f ("netfilter: synproxy: Check oom when adding synproxy
and seqadj ct extensions") wanted to drop the packet when it fails to add
seqadj ext due to no memory by checking if nfct_seqadj_ext_add returns
NULL.

But that nfct_seqadj_ext_add returns NULL can also happen when seqadj ext
already exists in a nf_conn. It will cause that userspace protocol doesn't
work when both dnat and snat are configured.

Li Shuang found this issue in the case:

Topo:
   ftp client                   router                  ftp server
  10.167.131.2  <-> 10.167.131.254  10.167.141.254 <-> 10.167.141.1

Rules:
  # iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp --dport 21 -j \
    DNAT --to-destination 10.167.141.1
  # iptables -t nat -A POSTROUTING -o eth2 -p tcp -m tcp --dport 21 -j \
    SNAT --to-source 10.167.141.254

In router, when both dnat and snat are added, nf_nat_setup_info will be
called twice. The packet can be dropped at the 2nd time for DNAT due to
seqadj ext is already added at the 1st time for SNAT.

This patch is to fix it by checking for seqadj ext existence before adding
it, so that the packet will not be dropped if seqadj ext already exists.

Note that as Florian mentioned, as a long term, we should review ext_add()
behaviour, it's better to return a pointer to the existing ext instead.

Fixes: 4440a2ab3b9f ("netfilter: synproxy: Check oom when adding synproxy and seqadj ct extensions")
Reported-by: Li Shuang <shuali@redhat.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: Preserve _PAGE_DEVMAP across mprotect() calls
Jan Kara [Tue, 9 Oct 2018 10:19:17 +0000 (12:19 +0200)]
mm: Preserve _PAGE_DEVMAP across mprotect() calls

commit 4628a64591e6cee181237060961e98c615c33966 upstream.

Currently _PAGE_DEVMAP bit is not preserved in mprotect(2) calls. As a
result we will see warnings such as:

BUG: Bad page map in process JobWrk0013  pte:800001803875ea25 pmd:7624381067
addr:00007f0930720000 vm_flags:280000f9 anon_vma:          (null) mapping:ffff97f2384056f0 index:0
file:457-000000fe00000030-00000009-000000ca-00000001_2001.fileblock fault:xfs_filemap_fault [xfs] mmap:xfs_file_mmap [xfs] readpage:          (null)
CPU: 3 PID: 15848 Comm: JobWrk0013 Tainted: G        W          4.12.14-2.g7573215-default #1 SLE12-SP4 (unreleased)
Hardware name: Intel Corporation S2600WFD/S2600WFD, BIOS SE5C620.86B.01.00.0833.051120182255 05/11/2018
Call Trace:
 dump_stack+0x5a/0x75
 print_bad_pte+0x217/0x2c0
 ? enqueue_task_fair+0x76/0x9f0
 _vm_normal_page+0xe5/0x100
 zap_pte_range+0x148/0x740
 unmap_page_range+0x39a/0x4b0
 unmap_vmas+0x42/0x90
 unmap_region+0x99/0xf0
 ? vma_gap_callbacks_rotate+0x1a/0x20
 do_munmap+0x255/0x3a0
 vm_munmap+0x54/0x80
 SyS_munmap+0x1d/0x30
 do_syscall_64+0x74/0x150
 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
...

when mprotect(2) gets used on DAX mappings. Also there is a wide variety
of other failures that can result from the missing _PAGE_DEVMAP flag
when the area gets used by get_user_pages() later.

Fix the problem by including _PAGE_DEVMAP in a set of flags that get
preserved by mprotect(2).

Fixes: 69660fd797c3 ("x86, mm: introduce _PAGE_DEVMAP")
Fixes: ebd31197931d ("powerpc/mm: Add devmap support for ppc64")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomremap: properly flush TLB before releasing the page
Linus Torvalds [Fri, 12 Oct 2018 22:22:59 +0000 (15:22 -0700)]
mremap: properly flush TLB before releasing the page

commit eb66ae030829605d61fbef1909ce310e29f78821 upstream.

Jann Horn points out that our TLB flushing was subtly wrong for the
mremap() case.  What makes mremap() special is that we don't follow the
usual "add page to list of pages to be freed, then flush tlb, and then
free pages".  No, mremap() obviously just _moves_ the page from one page
table location to another.

That matters, because mremap() thus doesn't directly control the
lifetime of the moved page with a freelist: instead, the lifetime of the
page is controlled by the page table locking, that serializes access to
the entry.

As a result, we need to flush the TLB not just before releasing the lock
for the source location (to avoid any concurrent accesses to the entry),
but also before we release the destination page table lock (to avoid the
TLB being flushed after somebody else has already done something to that
page).

This also makes the whole "need_flush" logic unnecessary, since we now
always end up flushing the TLB for every valid entry.

Reported-and-tested-by: Jann Horn <jannh@google.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Tested-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoiommu/amd: Return devid as alias for ACPI HID devices
Arindam Nath [Tue, 18 Sep 2018 10:10:58 +0000 (15:40 +0530)]
iommu/amd: Return devid as alias for ACPI HID devices

[ Upstream commit 5ebb1bc2d63d90dd204169e21fd7a0b4bb8c776e ]

ACPI HID devices do not actually have an alias for
them in the IVRS. But dev_data->alias is still used
for indexing into the IOMMU device table for devices
being handled by the IOMMU. So for ACPI HID devices,
we simply return the corresponding devid as an alias,
as parsed from IVRS table.

Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Fixes: 2bf9a0a12749 ('iommu/amd: Add iommu support for ACPI HID devices')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agopowerpc/tm: Avoid possible userspace r1 corruption on reclaim
Michael Neuling [Tue, 25 Sep 2018 09:36:47 +0000 (19:36 +1000)]
powerpc/tm: Avoid possible userspace r1 corruption on reclaim

[ Upstream commit 96dc89d526ef77604376f06220e3d2931a0bfd58 ]

Current we store the userspace r1 to PACATMSCRATCH before finally
saving it to the thread struct.

In theory an exception could be taken here (like a machine check or
SLB miss) that could write PACATMSCRATCH and hence corrupt the
userspace r1. The SLB fault currently doesn't touch PACATMSCRATCH, but
others do.

We've never actually seen this happen but it's theoretically
possible. Either way, the code is fragile as it is.

This patch saves r1 to the kernel stack (which can't fault) before we
turn MSR[RI] back on. PACATMSCRATCH is still used but only with
MSR[RI] off. We then copy r1 from the kernel stack to the thread
struct once we have MSR[RI] back on.

Suggested-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agopowerpc/tm: Fix userspace r13 corruption
Michael Neuling [Mon, 24 Sep 2018 07:27:04 +0000 (17:27 +1000)]
powerpc/tm: Fix userspace r13 corruption

[ Upstream commit cf13435b730a502e814c63c84d93db131e563f5f ]

When we treclaim we store the userspace checkpointed r13 to a scratch
SPR and then later save the scratch SPR to the user thread struct.

Unfortunately, this doesn't work as accessing the user thread struct
can take an SLB fault and the SLB fault handler will write the same
scratch SPRG that now contains the userspace r13.

To fix this, we store r13 to the kernel stack (which can't fault)
before we access the user thread struct.

Found by running P8 guest + powervm + disable_1tb_segments + TM. Seen
as a random userspace segfault with r13 looking like a kernel address.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agonet/mlx4: Use cpumask_available for eq->affinity_mask
Nathan Chancellor [Fri, 21 Sep 2018 09:44:12 +0000 (02:44 -0700)]
net/mlx4: Use cpumask_available for eq->affinity_mask

[ Upstream commit 8ac1ee6f4d62e781e3b3fd8b9c42b70371427669 ]

Clang warns that the address of a pointer will always evaluated as true
in a boolean context:

drivers/net/ethernet/mellanox/mlx4/eq.c:243:11: warning: address of
array 'eq->affinity_mask' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (!eq->affinity_mask || cpumask_empty(eq->affinity_mask))
            ~~~~~^~~~~~~~~~~~~
1 warning generated.

Use cpumask_available, introduced in commit f7e30f01a9e2 ("cpumask: Add
helper cpumask_available()"), which does the proper checking and avoids
this warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/86
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoscsi: sd: don't crash the host on invalid commands
Johannes Thumshirn [Fri, 21 Sep 2018 07:01:01 +0000 (09:01 +0200)]
scsi: sd: don't crash the host on invalid commands

[ Upstream commit f1f1fadacaf08b7cf11714c0c29f8fa4d4ef68a9 ]

When sd_init_command() get's a command with a unknown req_op() it crashes the
system via BUG().

This makes debugging the actual reason for the broken request cmd_flags pretty
hard as the system is down before it's able to write out debugging data on the
serial console or the trace buffer.

Change the BUG() to a WARN_ON() and return BLKPREP_KILL to fail gracefully and
return an I/O error to the producer of the request.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agodrm: mali-dp: Call drm_crtc_vblank_reset on device init
Alexandru Gheorghe [Mon, 16 Jul 2018 10:07:07 +0000 (11:07 +0100)]
drm: mali-dp: Call drm_crtc_vblank_reset on device init

[ Upstream commit 69be1984ded00a11b1ed0888c6d8e4f35370372f ]

Currently, if userspace calls drm_wait_vblank before the crtc is
activated the crtc vblank_enable hook is called, which in case of
malidp driver triggers some warninngs. This happens because on
device init we don't inform the drm core about the vblank state
by calling drm_crtc_vblank_on/off/reset which together with
drm_vblank_get have some magic that prevents calling drm_vblank_enable
when crtc is off.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoravb: do not write 1 to reserved bits
Kazuya Mizuguchi [Tue, 18 Sep 2018 10:22:26 +0000 (12:22 +0200)]
ravb: do not write 1 to reserved bits

[ Upstream commit 2fe397a3959de8a472f165e6d152f64cb77fa2cc ]

EtherAVB hardware requires 0 to be written to status register bits in
order to clear them, however, care must be taken not to:

1. Clear other bits, by writing zero to them
2. Write one to reserved bits

This patch corrects the ravb driver with respect to the second point above.
This is done by defining reserved bit masks for the affected registers and,
after auditing the code, ensure all sites that may write a one to a
reserved bit use are suitably masked.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoInput: atakbd - fix Atari CapsLock behaviour
Michael Schmitz [Mon, 17 Sep 2018 22:27:49 +0000 (15:27 -0700)]
Input: atakbd - fix Atari CapsLock behaviour

[ Upstream commit 52d2c7bf7c90217fbe875d2d76f310979c48eb83 ]

The CapsLock key on Atari keyboards is not a toggle, it does send the
normal make and break scancodes.

Drop the CapsLock toggle handling code, which did cause the CapsLock
key to merely act as a Shift key.

Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoInput: atakbd - fix Atari keymap
Andreas Schwab [Mon, 17 Sep 2018 19:43:34 +0000 (12:43 -0700)]
Input: atakbd - fix Atari keymap

[ Upstream commit 9e62df51be993035c577371ffee5477697a56aad ]

Fix errors in Atari keymap (mostly in keypad, help and undo keys).

Patch provided on debian-68k ML by Andreas Schwab <schwab@linux-m68k.org>,
keymap array size and unhandled scancode limit adjusted to 0x73 by me.

Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoscsi: ibmvscsis: Ensure partition name is properly NUL terminated
Laura Abbott [Tue, 11 Sep 2018 19:22:26 +0000 (12:22 -0700)]
scsi: ibmvscsis: Ensure partition name is properly NUL terminated

[ Upstream commit adad633af7b970bfa5dd1b624a4afc83cac9b235 ]

While reviewing another part of the code, Kees noticed that the strncpy of the
partition name might not always be NUL terminated. Switch to using strscpy
which does this safely.

Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoscsi: ibmvscsis: Fix a stringop-overflow warning
Laura Abbott [Tue, 11 Sep 2018 19:22:25 +0000 (12:22 -0700)]
scsi: ibmvscsis: Fix a stringop-overflow warning

[ Upstream commit d792d4c4fc866ae224b0b0ca2aabd87d23b4d6cc ]

There's currently a warning about string overflow with strncat:

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_probe':
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3479:2: error: 'strncat' specified
bound 64 equals destination size [-Werror=stringop-overflow=]
  strncat(vscsi->eye, vdev->name, MAX_EYE);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Switch to a single snprintf instead of a strcpy + strcat to handle this
cleanly.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoclocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs
Keerthy [Wed, 8 Aug 2018 13:14:59 +0000 (18:44 +0530)]
clocksource/drivers/ti-32k: Add CLOCK_SOURCE_SUSPEND_NONSTOP flag for non-am43 SoCs

[ Upstream commit 3b7d96a0dbb6b630878597a1838fc39f808b761b ]

The 32k clocksource is NONSTOP for non-am43 SoCs. Hence
add the flag for all the other SoCs.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: fix hardif_neigh refcount on queue_work() failure
Marek Lindner [Thu, 6 Sep 2018 21:45:55 +0000 (05:45 +0800)]
batman-adv: fix hardif_neigh refcount on queue_work() failure

[ Upstream commit 4c4af6900844ab04c9434c972021d7b48610e06a ]

The hardif_neigh refcounter is to be decreased by the queued work and
currently is never decreased if the queue_work() call fails.
Fix by checking the queue_work() return value and decrease refcount
if necessary.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: fix backbone_gw refcount on queue_work() failure
Marek Lindner [Thu, 6 Sep 2018 21:45:54 +0000 (05:45 +0800)]
batman-adv: fix backbone_gw refcount on queue_work() failure

[ Upstream commit 5af96b9c59c72fb2af2d19c5cc2f3cdcee391dff ]

The backbone_gw refcounter is to be decreased by the queued work and
currently is never decreased if the queue_work() call fails.
Fix by checking the queue_work() return value and decrease refcount
if necessary.

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Prevent duplicated tvlv handler
Sven Eckelmann [Sun, 12 Aug 2018 19:04:45 +0000 (21:04 +0200)]
batman-adv: Prevent duplicated tvlv handler

[ Upstream commit ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb ]

The function batadv_tvlv_handler_register is responsible for adding new
tvlv_handler to the handler_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Prevent duplicated global TT entry
Sven Eckelmann [Sun, 12 Aug 2018 19:04:44 +0000 (21:04 +0200)]
batman-adv: Prevent duplicated global TT entry

[ Upstream commit e7136e48ffdfb9f37b0820f619380485eb407361 ]

The function batadv_tt_global_orig_entry_add is responsible for adding new
tt_orig_list_entry to the orig_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: d657e621a0f5 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Prevent duplicated softif_vlan entry
Sven Eckelmann [Sun, 12 Aug 2018 19:04:43 +0000 (21:04 +0200)]
batman-adv: Prevent duplicated softif_vlan entry

[ Upstream commit 94cb82f594ed86be303398d6dfc7640a6f1d45d4 ]

The function batadv_softif_vlan_get is responsible for adding new
softif_vlan to the softif_vlan_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Prevent duplicated nc_node entry
Sven Eckelmann [Sun, 12 Aug 2018 19:04:42 +0000 (21:04 +0200)]
batman-adv: Prevent duplicated nc_node entry

[ Upstream commit fa122fec8640eb7186ce5a41b83a4c1744ceef8f ]

The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
to the in_coding_list and out_coding_list. It first checks whether the
entry already is in the list or not. If it is, then the creation of a new
entry is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Fix segfault when writing to sysfs elp_interval
Sven Eckelmann [Fri, 31 Aug 2018 14:56:29 +0000 (16:56 +0200)]
batman-adv: Fix segfault when writing to sysfs elp_interval

[ Upstream commit a25bab9d723a08bd0bdafb1529faf9094c690b70 ]

The per hardif sysfs file "batman_adv/elp_interval" is using the generic
functions to store/show uint values. The helper __batadv_store_uint_attr
requires the softif net_device as parameter to print the resulting change
as info text when the users writes to this file. It uses the helper
function batadv_info to add it at the same time to the kernel ring buffer
and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG is enabled).

The function batadv_info requires as first parameter the batman-adv softif
net_device. This parameter is then used to find the private buffer which
contains the debug log for this batman-adv interface. But
batadv_store_throughput_override used as first argument the slave
net_device. This slave device doesn't have the batadv_priv private data
which is access by batadv_info.

Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
to a segfault or to memory corruption.

Fixes: 0744ff8fa8fa ("batman-adv: Add hard_iface specific sysfs wrapper macros for UINT")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agobatman-adv: Fix segfault when writing to throughput_override
Sven Eckelmann [Fri, 31 Aug 2018 14:46:47 +0000 (16:46 +0200)]
batman-adv: Fix segfault when writing to throughput_override

[ Upstream commit b9fd14c20871e6189f635e49b32d7789e430b3c8 ]

The per hardif sysfs file "batman_adv/throughput_override" prints the
resulting change as info text when the users writes to this file. It uses
the helper function batadv_info to add it at the same time to the kernel
ring buffer and to the batman-adv debug log (when CONFIG_BATMAN_ADV_DEBUG
is enabled).

The function batadv_info requires as first parameter the batman-adv softif
net_device. This parameter is then used to find the private buffer which
contains the debug log for this batman-adv interface. But
batadv_store_throughput_override used as first argument the slave
net_device. This slave device doesn't have the batadv_priv private data
which is access by batadv_info.

Writing to this file with CONFIG_BATMAN_ADV_DEBUG enabled can either lead
to a segfault or to memory corruption.

Fixes: 0b5ecc6811bd ("batman-adv: add throughput override attribute to hard_ifaces")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomedia: af9035: prevent buffer overflow on write
Jozef Balga [Tue, 21 Aug 2018 09:01:04 +0000 (05:01 -0400)]
media: af9035: prevent buffer overflow on write

[ Upstream commit 312f73b648626a0526a3aceebb0a3192aaba05ce ]

When less than 3 bytes are written to the device, memcpy is called with
negative array size which leads to buffer overflow and kernel panic. This
patch adds a condition and returns -EOPNOTSUPP instead.
Fixes bugzilla issue 64871

[mchehab+samsung@kernel.org: fix a merge conflict and changed the
 condition to match the patch's comment, e. g. len == 3 could
 also be valid]
Signed-off-by: Jozef Balga <jozef.balga@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoblk-mq: flush pending hctx->run_work before freeing hctx
Manikanta Maddireddy [Sun, 14 Oct 2018 17:54:29 +0000 (10:54 -0700)]
blk-mq: flush pending hctx->run_work before freeing hctx

During resume block driver starts the queues and add hctx->run_work to wq
to process the pending request in hardware queue. In the same sequence
block driver frees the hw queues if respective mapped CPU is offline.
If the hctx->run_work schedules afterwards, kernel crashes because hctx
is freed. To fix the issue flush hctx->run_work before freeing hctx.

Unable to handle kernel NULL pointer dereference at virtual address 00000000
Mem abort info:
  ESR = 0x96000005
  Exception class = DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000005
  CM = 0, WnR = 0
user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc364390000
[0000000000000000] *pgd=0000000000000000, *pud=0000000000000000
Internal error: Oops: 96000005 [#1] PREEMPT SMP
CPU: 1 PID: 49 Comm: kworker/6:0H Tainted: G         C      4.9.132-tegra-g8cc25a4-dirty #9
Hardware name: galen (DT)
Workqueue: kblockd blk_mq_run_work_fn
task: ffffffc3ecc08d40 task.stack: ffffffc3ecc14000
PC is at __blk_mq_run_hw_queue+0xfc/0x858
LR is at __blk_mq_run_hw_queue+0x618/0x858
pc : [<ffffff80087b565c>] lr : [<ffffff80087b5b78>] pstate: 80c00045
sp : ffffffc3ecc17c00
x29: ffffffc3ecc17c00 x28: ffffffc3ecc17cc8
x27: 0000000000000000 x26: 0000000000000000
x25: 0000000000000000 x24: ffffffc3d4088000
x23: 0000000000000000 x22: ffffffc3ecc17cb8
x21: ffffffc3d3843090 x20: ffffffc3d3843000
x19: 0000000000000000 x18: ffffff800a7d7450
x17: 0000000000000000 x16: 0000000000000002
x15: ffffff800a7d7468 x14: 3d3d3d3d3d3d3d3d
x13: 3d3d3d3d3d3d3d3d x12: 3d3d3d3d3d3d3d3d
x11: 3d3d3d3d3d3d3d3d x10: 3d3d3d3d3d3d3d3d
x9 : 3d3d3d3d3d3d3d3d x8 : ffffffc3ffc53838
x7 : 0000000000000000 x6 : ffffffc3ffc53838
x5 : 0000000000000000 x4 : 0000000000000001
x3 : 0000000000000050 x2 : 0000000000000000
x1 : 0000000000040984 x0 : 0000000000000000

Process kworker/6:0H (pid: 49, stack limit = 0xffffffc3ecc14028)
Call trace:
[<ffffff80087b565c>] __blk_mq_run_hw_queue+0xfc/0x858
[<ffffff80087b5e18>] blk_mq_run_work_fn+0x20/0x30
[<ffffff8008105398>] process_one_work+0x1d8/0xb30
[<ffffff8008105e78>] worker_thread+0x188/0x790
[<ffffff800811119c>] kthread+0x12c/0x200
[<ffffff80080837d0>] ret_from_fork+0x10/0x40

bug 200456501

Change-Id: Iecf16bb18daa514bb6700080e3ff7951a9c5126a
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1926876
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoblk-mq: avoid to map CPU into stale hw queue
Ming Lei [Sat, 6 Jan 2018 08:27:39 +0000 (16:27 +0800)]
blk-mq: avoid to map CPU into stale hw queue

blk_mq_pci_map_queues() may not map one CPU into any hw queue, but its
previous map isn't cleared yet, and may point to one stale hw queue
index.

This patch fixes the following issue by clearing the mapping table before
setting it up in blk_mq_pci_map_queues().

This patches fixes this following issue reported by Zhang Yi:

[  101.202734] BUG: unable to handle kernel NULL pointer dereference at 0000000094d3013f
[  101.211487] IP: blk_mq_map_swqueue+0xbc/0x200
[  101.216346] PGD 0 P4D 0
[  101.219171] Oops: 0000 [#1] SMP
[  101.222674] Modules linked in: sunrpc ipmi_ssif vfat fat intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel intel_cstate intel_uncore mxm_wmi intel_rapl_perf iTCO_wdt ipmi_si ipmi_devintf pcspkr iTCO_vendor_support sg dcdbas ipmi_msghandler wmi mei_me lpc_ich shpchp mei acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm ahci libahci crc32c_intel libata tg3 nvme nvme_core megaraid_sas ptp i2c_core pps_core dm_mirror dm_region_hash dm_log dm_mod
[  101.284881] CPU: 0 PID: 504 Comm: kworker/u25:5 Not tainted 4.15.0-rc2 #1
[  101.292455] Hardware name: Dell Inc. PowerEdge R730xd/072T6D, BIOS 2.5.5 08/16/2017
[  101.301001] Workqueue: nvme-wq nvme_reset_work [nvme]
[  101.306636] task: 00000000f2c53190 task.stack: 000000002da874f9
[  101.313241] RIP: 0010:blk_mq_map_swqueue+0xbc/0x200
[  101.318681] RSP: 0018:ffffc9000234fd70 EFLAGS: 00010282
[  101.324511] RAX: ffff88047ffc9480 RBX: ffff88047e130850 RCX: 0000000000000000
[  101.332471] RDX: ffffe8ffffd40580 RSI: ffff88047e509b40 RDI: ffff88046f37a008
[  101.340432] RBP: 000000000000000b R08: ffff88046f37a008 R09: 0000000011f94280
[  101.348392] R10: ffff88047ffd4d00 R11: 0000000000000000 R12: ffff88046f37a008
[  101.356353] R13: ffff88047e130f38 R14: 000000000000000b R15: ffff88046f37a558
[  101.364314] FS:  0000000000000000(0000) GS:ffff880277c00000(0000) knlGS:0000000000000000
[  101.373342] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  101.379753] CR2: 0000000000000098 CR3: 000000047f409004 CR4: 00000000001606f0
[  101.387714] Call Trace:
[  101.390445]  blk_mq_update_nr_hw_queues+0xbf/0x130
[  101.395791]  nvme_reset_work+0x6f4/0xc06 [nvme]
[  101.400848]  ? pick_next_task_fair+0x290/0x5f0
[  101.405807]  ? __switch_to+0x1f5/0x430
[  101.409988]  ? put_prev_entity+0x2f/0xd0
[  101.414365]  process_one_work+0x141/0x340
[  101.418836]  worker_thread+0x47/0x3e0
[  101.422921]  kthread+0xf5/0x130
[  101.426424]  ? rescuer_thread+0x380/0x380
[  101.430896]  ? kthread_associate_blkcg+0x90/0x90
[  101.436048]  ret_from_fork+0x1f/0x30
[  101.440034] Code: 48 83 3c ca 00 0f 84 2b 01 00 00 48 63 cd 48 8b 93 10 01 00 00 8b 0c 88 48 8b 83 20 01 00 00 4a 03 14 f5 60 04 af 81 48 8b 0c c8 <48> 8b 81 98 00 00 00 f0 4c 0f ab 30 8b 81 f8 00 00 00 89 42 44
[  101.461116] RIP: blk_mq_map_swqueue+0xbc/0x200 RSP: ffffc9000234fd70
[  101.468205] CR2: 0000000000000098
[  101.471907] ---[ end trace 5fe710f98228a3ca ]---
[  101.482489] Kernel panic - not syncing: Fatal exception
[  101.488505] Kernel Offset: disabled
[  101.497752] ---[ end Kernel panic - not syncing: Fatal exception

bug 200456501

Change-Id: I7cbed6a8d244a0ba4d2a17eb269d81005f4ae02e
Reviewed-by: Christoph Hellwig <hch@lst.de>
Suggested-by: Christoph Hellwig <hch@lst.de>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Reviewed-on: https://git-master.nvidia.com/r/1926246
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Tested-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoblk-mq: remap queues when adding/removing hardware queues
Omar Sandoval [Fri, 7 Apr 2017 14:53:11 +0000 (08:53 -0600)]
blk-mq: remap queues when adding/removing hardware queues

blk_mq_update_nr_hw_queues() used to remap hardware queues, which is the
behavior that drivers expect. However, commit 4e68a011428a changed
blk_mq_queue_reinit() to not remap queues for the case of CPU
hotplugging, inadvertently making blk_mq_update_nr_hw_queues() not remap
queues as well. This breaks, for example, NBD's multi-connection mode,
leaving the added hardware queues unused. Fix it by making
blk_mq_update_nr_hw_queues() explicitly remap the queues.

bug 200456501

Change-Id: Idd00bac7106378748b6c9e1ab0af31e6fb136535
Fixes: 4e68a011428a ("blk-mq: don't redistribute hardware queues on a CPU hotplug event")
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Reviewed-on: https://git-master.nvidia.com/r/1926247
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Tested-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarch: arm64: configs: enable CONFIG_DM_VERITY_AVB
Gerber Huang [Fri, 12 Oct 2018 07:36:24 +0000 (15:36 +0800)]
arch: arm64: configs: enable CONFIG_DM_VERITY_AVB

- enable avb 2.0 invalidate mode by CONFIG_DM_VERITY_AVB=y

Bug 200437731

Change-Id: I066f426ea0b71c094626ec95baab3f4578a9da88
Signed-off-by: Gerber Huang <gerberh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1925360
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoANDROID: AVB error handler to invalidate vbmeta partition.
David Zeuthen [Tue, 24 Jan 2017 18:17:01 +0000 (13:17 -0500)]
ANDROID: AVB error handler to invalidate vbmeta partition.

If androidboot.vbmeta.invalidate_on_error is 'yes' and
androidboot.vbmeta.device is set and points to a device with vbmeta
magic, this header will be overwritten upon an irrecoverable dm-verity
error. The side-effect of this is that the slot will fail to verify on
next reboot, effectively triggering the boot loader to fallback to
another slot. This work both if the vbmeta struct is at the start of a
partition or if there's an AVB footer at the end.

This code is based on drivers/md/dm-verity-chromeos.c from ChromiumOS.

Signed-off-by: David Zeuthen <zeuthen@google.com>
(cherry picked from commit 9dc978d43ec78fb3d5126c1155369bd70d29fc96)

Bug 200437731

Change-Id: I2a8b155007a82ef70891584d031494895c7fa112
Reviewed-on: https://git-master.nvidia.com/r/1925339
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gerber Huang <gerberh@nvidia.com>
Tested-by: Gerber Huang <gerberh@nvidia.com>
Reviewed-by: Yijun Zhou <yijunz@nvidia.com>
Reviewed-by: Ian Chang <ianc@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agomemory: tegra: wait correct DLL state for dll update
Ken Chang [Tue, 2 Oct 2018 05:34:51 +0000 (13:34 +0800)]
memory: tegra: wait correct DLL state for dll update

At the end of the DLL disable/enable sequence, it needs to wait on
update of bit CFG_DLL_EN of the EMC_CFG_DIG_DLL shadowed register.
Currently the enable seqneuce also waits on DISABLED state, this is
causing long time elapsed in wait_for_update() and eventually bails
out due to timeout.
This patch fix the above issue.

Bug 2378628
Bug 2403305

Change-Id: Ied2e8be1babd62f703495682b0d17b422ab17cb6
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1917223
(cherry picked from commit dd1c10f635df58419edf5183c512cfc5d7714605)
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928629
GVS: Gerrit_Virtual_Submit
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoHACK: arm64: configs: disable Tegra FIQ debugger
Vince Hsu [Tue, 16 Oct 2018 06:57:42 +0000 (14:57 +0800)]
HACK: arm64: configs: disable Tegra FIQ debugger

Disable Tegra FIQ debugger to unblock rel-32.

Bug 200456698

Change-Id: I4c6c9cc1eae6a9c5257f66f8fcce7ad51bef0886
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1927960
Reviewed-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Tested-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agomemory: tegra: avoid divide-by-zero during boot on TX1
Stephen Warren [Thu, 11 Oct 2018 20:39:04 +0000 (14:39 -0600)]
memory: tegra: avoid divide-by-zero during boot on TX1

gcc 7.3 detects a code-path that can perform a divide-by-zero and replaces
this with an explicit "brk #0x3e8" (i.e. "brk #1000") instruction, which
causes a crash if the code is executed. This happens in the EMC driver
when Jetson TX1 is booting:

Unexpected kernel BRK exception at EL1
Unhandled debug exception: ptrace BRK handler (0xf20003e8) at 0x0000000000000000

This occurs because update_clock_tree_delay() always calculates "cval" in
various code-paths, but has only calculated the inputs to cval's
calculation in certain cases, hence causing divide-by-zero to occur in
other cases. This patch skips the calculation of cval except in the cases
where the input values have been calculated. This is acceptable since the
value of cval is only used in those same cases.

Bug 200442298

Change-Id: I9d3f67d9e59e8b432c93b3785129c05a89e3de5f
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1924870
(cherry picked from commit 0d2b169473775719a6e1721287f7037953ef3699 in dev-kernel-4.9)
Reviewed-on: https://git-master.nvidia.com/r/1929075
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoarm64: config: tegra: Enable Ext2 extended attributes
Gagan Grover [Wed, 3 Oct 2018 17:34:06 +0000 (10:34 -0700)]
arm64: config: tegra: Enable Ext2 extended attributes

Below VTS tests were failing as ext2 xattr was disabled.

VtsKernelLtp#fs.fs_fill_64bit
VtsKernelLtp#syscalls.fallocate04_64bit
VtsKernelLtp#syscalls.fallocate05_64bit
VtsKernelLtp#syscalls.fsync01_64bit
VtsKernelLtp#syscalls.msync04_64bit
VtsKernelLtp#syscalls.setxattr01_64bit

All above tests passed after enabling ext2 extended attributes.
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y

Bug 200445675

Change-Id: I8e99a047857947490b3cdf711af90ad10a68f988
Reviewed-on: https://git-master.nvidia.com/r/1918385
(cherry picked from commit a00988506a74b6b1e45f30f01e309471a1c21a52)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1926870
GVS: Gerrit_Virtual_Submit
Reviewed-by: Siddardha Naraharisetti <siddardhan@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
6 years agoMerge 4.9.134 into android-4.9-o
Greg Kroah-Hartman [Thu, 18 Oct 2018 17:19:43 +0000 (19:19 +0200)]
Merge 4.9.134 into android-4.9-o

Changes in 4.9.134
ASoC: wm8804: Add ACPI support
ASoC: sigmadsp: safeload should not have lower byte limit
selftests/efivarfs: add required kernel configs
selftests: memory-hotplug: add required configs
mfd: omap-usb-host: Fix dts probe of children
scsi: iscsi: target: Don't use stack buffer for scatterlist
scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted()
sound: enable interrupt after dma buffer initialization
stmmac: fix valid numbers of unicast filter entries
net: macb: disable scatter-gather for macb on sama5d3
ARM: dts: at91: add new compatibility string for macb on sama5d3
x86/kvm/lapic: always disable MMIO interface in x2APIC mode
drm/amdgpu: Fix SDMA HQD destroy error on gfx_v7
ext4: Fix error code in ext4_xattr_set_entry()
mm/vmstat.c: fix outdated vmstat_text
mach64: detect the dot clock divider correctly on sparc
perf script python: Fix export-to-postgresql.py occasional failure
i2c: i2c-scmi: fix for i2c_smbus_write_block_data
xhci: Don't print a warning when setting link state for disabled ports
bnxt_en: Fix TX timeout during netpoll.
bonding: avoid possible dead-lock
ip6_tunnel: be careful when accessing the inner header
ip_tunnel: be careful when accessing the inner header
ipv4: fix use-after-free in ip_cmsg_recv_dstaddr()
ipv6: take rcu lock in rawv6_send_hdrinc()
net: dsa: bcm_sf2: Call setup during switch resume
net: hns: fix for unmapping problem when SMMU is on
net: ipv4: update fnhe_pmtu when first hop's MTU changes
net/ipv6: Display all addresses in output of /proc/net/if_inet6
netlabel: check for IPV4MASK in addrinfo_get
net/usb: cancel pending work when unbinding smsc75xx
qlcnic: fix Tx descriptor corruption on 82xx devices
qmi_wwan: Added support for Gemalto's Cinterion ALASxx WWAN interface
team: Forbid enslaving team device to itself
net: dsa: bcm_sf2: Fix unbind ordering
net: mvpp2: Extract the correct ethtype from the skb for tx csum offload
net: systemport: Fix wake-up interrupt race during resume
rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096
tcp/dccp: fix lockdep issue when SYN is backlogged
inet: make sure to grab rcu_read_lock before using ireq->ireq_opt
inet: frags: change inet_frags_init_net() return value
inet: frags: add a pointer to struct netns_frags
inet: frags: refactor ipfrag_init()
inet: frags: refactor ipv6_frag_init()
inet: frags: refactor lowpan_net_frag_init()
ipv6: export ip6 fragments sysctl to unprivileged users
rhashtable: add schedule points
inet: frags: use rhashtables for reassembly units
inet: frags: remove some helpers
inet: frags: get rif of inet_frag_evicting()
inet: frags: remove inet_frag_maybe_warn_overflow()
inet: frags: break the 2GB limit for frags storage
inet: frags: do not clone skb in ip_expire()
ipv6: frags: rewrite ip6_expire_frag_queue()
rhashtable: reorganize struct rhashtable layout
inet: frags: reorganize struct netns_frags
inet: frags: get rid of ipfrag_skb_cb/FRAG_CB
inet: frags: fix ip6frag_low_thresh boundary
ip: discard IPv4 datagrams with overlapping segments.
net: speed up skb_rbtree_purge()
net: modify skb_rbtree_purge to return the truesize of all purged skbs.
ipv6: defrag: drop non-last frags smaller than min mtu
net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends
net: add rb_to_skb() and other rb tree helpers
ip: use rb trees for IP frag queue.
ip: add helpers to process in-order fragments faster.
ip: process in-order fragments efficiently
ip: frags: fix crash in ip_do_fragment()
ipv4: frags: precedence bug in ip_expire()
Linux 4.9.134

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
6 years agoLinux 4.9.134
Greg Kroah-Hartman [Thu, 18 Oct 2018 07:13:26 +0000 (09:13 +0200)]
Linux 4.9.134

6 years agoipv4: frags: precedence bug in ip_expire()
Dan Carpenter [Wed, 10 Oct 2018 19:30:17 +0000 (12:30 -0700)]
ipv4: frags: precedence bug in ip_expire()

(commit 70837ffe3085c9a91488b52ca13ac84424da1042 upstream)

We accidentally removed the parentheses here, but they are required
because '!' has higher precedence than '&'.

Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoip: frags: fix crash in ip_do_fragment()
Taehee Yoo [Wed, 10 Oct 2018 19:30:16 +0000 (12:30 -0700)]
ip: frags: fix crash in ip_do_fragment()

commit 5d407b071dc369c26a38398326ee2be53651cfe4 upstream

A kernel crash occurrs when defragmented packet is fragmented
in ip_do_fragment().
In defragment routine, skb_orphan() is called and
skb->ip_defrag_offset is set. but skb->sk and
skb->ip_defrag_offset are same union member. so that
frag->sk is not NULL.
Hence crash occurrs in skb->sk check routine in ip_do_fragment() when
defragmented packet is fragmented.

test commands:
   %iptables -t nat -I POSTROUTING -j MASQUERADE
   %hping3 192.168.4.2 -s 1000 -p 2000 -d 60000

splat looks like:
[  261.069429] kernel BUG at net/ipv4/ip_output.c:636!
[  261.075753] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[  261.083854] CPU: 1 PID: 1349 Comm: hping3 Not tainted 4.19.0-rc2+ #3
[  261.100977] RIP: 0010:ip_do_fragment+0x1613/0x2600
[  261.106945] Code: e8 e2 38 e3 fe 4c 8b 44 24 18 48 8b 74 24 08 e9 92 f6 ff ff 80 3c 02 00 0f 85 da 07 00 00 48 8b b5 d0 00 00 00 e9 25 f6 ff ff <0f> 0b 0f 0b 44 8b 54 24 58 4c 8b 4c 24 18 4c 8b 5c 24 60 4c 8b 6c
[  261.127015] RSP: 0018:ffff8801031cf2c0 EFLAGS: 00010202
[  261.134156] RAX: 1ffff1002297537b RBX: ffffed0020639e6e RCX: 0000000000000004
[  261.142156] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880114ba9bd8
[  261.150157] RBP: ffff880114ba8a40 R08: ffffed0022975395 R09: ffffed0022975395
[  261.158157] R10: 0000000000000001 R11: ffffed0022975394 R12: ffff880114ba9ca4
[  261.166159] R13: 0000000000000010 R14: ffff880114ba9bc0 R15: dffffc0000000000
[  261.174169] FS:  00007fbae2199700(0000) GS:ffff88011b400000(0000) knlGS:0000000000000000
[  261.183012] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  261.189013] CR2: 00005579244fe000 CR3: 0000000119bf4000 CR4: 00000000001006e0
[  261.198158] Call Trace:
[  261.199018]  ? dst_output+0x180/0x180
[  261.205011]  ? save_trace+0x300/0x300
[  261.209018]  ? ip_copy_metadata+0xb00/0xb00
[  261.213034]  ? sched_clock_local+0xd4/0x140
[  261.218158]  ? kill_l4proto+0x120/0x120 [nf_conntrack]
[  261.223014]  ? rt_cpu_seq_stop+0x10/0x10
[  261.227014]  ? find_held_lock+0x39/0x1c0
[  261.233008]  ip_finish_output+0x51d/0xb50
[  261.237006]  ? ip_fragment.constprop.56+0x220/0x220
[  261.243011]  ? nf_ct_l4proto_register_one+0x5b0/0x5b0 [nf_conntrack]
[  261.250152]  ? rcu_is_watching+0x77/0x120
[  261.255010]  ? nf_nat_ipv4_out+0x1e/0x2b0 [nf_nat_ipv4]
[  261.261033]  ? nf_hook_slow+0xb1/0x160
[  261.265007]  ip_output+0x1c7/0x710
[  261.269005]  ? ip_mc_output+0x13f0/0x13f0
[  261.273002]  ? __local_bh_enable_ip+0xe9/0x1b0
[  261.278152]  ? ip_fragment.constprop.56+0x220/0x220
[  261.282996]  ? nf_hook_slow+0xb1/0x160
[  261.287007]  raw_sendmsg+0x21f9/0x4420
[  261.291008]  ? dst_output+0x180/0x180
[  261.297003]  ? sched_clock_cpu+0x126/0x170
[  261.301003]  ? find_held_lock+0x39/0x1c0
[  261.306155]  ? stop_critical_timings+0x420/0x420
[  261.311004]  ? check_flags.part.36+0x450/0x450
[  261.315005]  ? _raw_spin_unlock_irq+0x29/0x40
[  261.320995]  ? _raw_spin_unlock_irq+0x29/0x40
[  261.326142]  ? cyc2ns_read_end+0x10/0x10
[  261.330139]  ? raw_bind+0x280/0x280
[  261.334138]  ? sched_clock_cpu+0x126/0x170
[  261.338995]  ? check_flags.part.36+0x450/0x450
[  261.342991]  ? __lock_acquire+0x4500/0x4500
[  261.348994]  ? inet_sendmsg+0x11c/0x500
[  261.352989]  ? dst_output+0x180/0x180
[  261.357012]  inet_sendmsg+0x11c/0x500
[ ... ]

v2:
 - clear skb->sk at reassembly routine.(Eric Dumarzet)

Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoip: process in-order fragments efficiently
Peter Oskolkov [Wed, 10 Oct 2018 19:30:15 +0000 (12:30 -0700)]
ip: process in-order fragments efficiently

This patch changes the runtime behavior of IP defrag queue:
incoming in-order fragments are added to the end of the current
list/"run" of in-order fragments at the tail.

On some workloads, UDP stream performance is substantially improved:

RX: ./udp_stream -F 10 -T 2 -l 60
TX: ./udp_stream -c -H <host> -F 10 -T 5 -l 60

with this patchset applied on a 10Gbps receiver:

  throughput=9524.18
  throughput_units=Mbit/s

upstream (net-next):

  throughput=4608.93
  throughput_units=Mbit/s

Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a4fd284a1f8fd4b6c59aa59db2185b1e17c5c11c)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoip: add helpers to process in-order fragments faster.
Peter Oskolkov [Wed, 10 Oct 2018 19:30:14 +0000 (12:30 -0700)]
ip: add helpers to process in-order fragments faster.

This patch introduces several helper functions/macros that will be
used in the follow-up patch. No runtime changes yet.

The new logic (fully implemented in the second patch) is as follows:

* Nodes in the rb-tree will now contain not single fragments, but lists
  of consecutive fragments ("runs").

* At each point in time, the current "active" run at the tail is
  maintained/tracked. Fragments that arrive in-order, adjacent
  to the previous tail fragment, are added to this tail run without
  triggering the re-balancing of the rb-tree.

* If a fragment arrives out of order with the offset _before_ the tail run,
  it is inserted into the rb-tree as a single fragment.

* If a fragment arrives after the current tail fragment (with a gap),
  it starts a new "tail" run, as is inserted into the rb-tree
  at the end as the head of the new run.

skb->cb is used to store additional information
needed here (suggested by Eric Dumazet).

Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 353c9cb360874e737fb000545f783df756c06f9a)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoip: use rb trees for IP frag queue.
Peter Oskolkov [Wed, 10 Oct 2018 19:30:13 +0000 (12:30 -0700)]
ip: use rb trees for IP frag queue.

(commit fa0f527358bd900ef92f925878ed6bfbd51305cc upstream)

Similar to TCP OOO RX queue, it makes sense to use rb trees to store
IP fragments, so that OOO fragments are inserted faster.

Tested:

- a follow-up patch contains a rather comprehensive ip defrag
  self-test (functional)
- ran neper `udp_stream -c -H <host> -F 100 -l 300 -T 20`:
    netstat --statistics
    Ip:
        282078937 total packets received
        0 forwarded
        0 incoming packets discarded
        946760 incoming packets delivered
        18743456 requests sent out
        101 fragments dropped after timeout
        282077129 reassemblies required
        944952 packets reassembled ok
        262734239 packet reassembles failed
   (The numbers/stats above are somewhat better re:
    reassemblies vs a kernel without this patchset. More
    comprehensive performance testing TBD).

Reported-by: Jann Horn <jannh@google.com>
Reported-by: Juha-Matti Tilli <juha-matti.tilli@iki.fi>
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agonet: add rb_to_skb() and other rb tree helpers
Eric Dumazet [Wed, 10 Oct 2018 19:30:12 +0000 (12:30 -0700)]
net: add rb_to_skb() and other rb tree helpers

Geeralize private netem_rb_to_skb()

TCP rtx queue will soon be converted to rb-tree,
so we will need skb_rbtree_walk() helpers.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 18a4c0eab2623cc95be98a1e6af1ad18e7695977)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agonet: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends
Eric Dumazet [Wed, 10 Oct 2018 19:30:11 +0000 (12:30 -0700)]
net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends

After working on IP defragmentation lately, I found that some large
packets defeat CHECKSUM_COMPLETE optimization because of NIC adding
zero paddings on the last (small) fragment.

While removing the padding with pskb_trim_rcsum(), we set skb->ip_summed
to CHECKSUM_NONE, forcing a full csum validation, even if all prior
fragments had CHECKSUM_COMPLETE set.

We can instead compute the checksum of the part we are trimming,
usually smaller than the part we keep.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 88078d98d1bb085d72af8437707279e203524fa5)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoipv6: defrag: drop non-last frags smaller than min mtu
Florian Westphal [Wed, 10 Oct 2018 19:30:10 +0000 (12:30 -0700)]
ipv6: defrag: drop non-last frags smaller than min mtu

don't bother with pathological cases, they only waste cycles.
IPv6 requires a minimum MTU of 1280 so we should never see fragments
smaller than this (except last frag).

v3: don't use awkward "-offset + len"
v2: drop IPv4 part, which added same check w. IPV4_MIN_MTU (68).
    There were concerns that there could be even smaller frags
    generated by intermediate nodes, e.g. on radio networks.

Cc: Peter Oskolkov <posk@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0ed4229b08c13c84a3c301a08defdc9e7f4467e6)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>