From ab5a003b5b2691e6b933cf7e2ca7b5517b11953c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 6 May 2019 16:29:24 +0200 Subject: [PATCH] 4.4-stable patches added patches: input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch selinux-never-allow-relabeling-on-context-mounts.patch x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch --- ...sary-driver-data-before-enabling-irq.patch | 46 ++++++++++ ...v7670-fix-pll-bypass-register-values.patch | 82 ++++++++++++++++++ ...r-allow-relabeling-on-context-mounts.patch | 83 +++++++++++++++++++ queue-4.4/series | 4 + ...essage-when-kernel-cannot-recover-p2.patch | 50 +++++++++++ 5 files changed, 265 insertions(+) create mode 100644 queue-4.4/input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch create mode 100644 queue-4.4/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch create mode 100644 queue-4.4/selinux-never-allow-relabeling-on-context-mounts.patch create mode 100644 queue-4.4/x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch diff --git a/queue-4.4/input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch b/queue-4.4/input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch new file mode 100644 index 00000000000..305a9e48e4f --- /dev/null +++ b/queue-4.4/input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch @@ -0,0 +1,46 @@ +From bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 Mon Sep 17 00:00:00 2001 +From: Anson Huang +Date: Wed, 3 Apr 2019 15:14:44 -0700 +Subject: Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ + +From: Anson Huang + +commit bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 upstream. + +SNVS IRQ is requested before necessary driver data initialized, +if there is a pending IRQ during driver probe phase, kernel +NULL pointer panic will occur in IRQ handler. To avoid such +scenario, just initialize necessary driver data before enabling +IRQ. This patch is inspired by NXP's internal kernel tree. + +Fixes: d3dc6e232215 ("input: keyboard: imx: add snvs power key driver") +Signed-off-by: Anson Huang +Signed-off-by: Dmitry Torokhov +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/input/keyboard/snvs_pwrkey.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/input/keyboard/snvs_pwrkey.c ++++ b/drivers/input/keyboard/snvs_pwrkey.c +@@ -156,6 +156,9 @@ static int imx_snvs_pwrkey_probe(struct + return error; + } + ++ pdata->input = input; ++ platform_set_drvdata(pdev, pdata); ++ + error = devm_request_irq(&pdev->dev, pdata->irq, + imx_snvs_pwrkey_interrupt, + 0, pdev->name, pdev); +@@ -172,9 +175,6 @@ static int imx_snvs_pwrkey_probe(struct + return error; + } + +- pdata->input = input; +- platform_set_drvdata(pdev, pdata); +- + device_init_wakeup(&pdev->dev, pdata->wakeup); + + return 0; diff --git a/queue-4.4/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch b/queue-4.4/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch new file mode 100644 index 00000000000..eebb4c45687 --- /dev/null +++ b/queue-4.4/media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch @@ -0,0 +1,82 @@ +From 61da76beef1e4f0b6ba7be4f8d0cf0dac7ce1f55 Mon Sep 17 00:00:00 2001 +From: Jacopo Mondi +Date: Fri, 29 Dec 2017 07:22:26 -0500 +Subject: media: v4l2: i2c: ov7670: Fix PLL bypass register values + +From: Jacopo Mondi + +commit 61da76beef1e4f0b6ba7be4f8d0cf0dac7ce1f55 upstream. + +The following commits: +commit f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") +commit 04ee6d92047e ("[media] media: ov7670: add possibility to bypass pll for ov7675") +introduced the ability to bypass PLL multiplier and use input clock (xvclk) +as pixel clock output frequency for ov7675 sensor. + +PLL is bypassed using register DBLV[7:6], according to ov7670 and ov7675 +sensor manuals. Macros used to set DBLV register seem wrong in the +driver, as their values do not match what reported in the datasheet. + +Fix by changing DBLV_* macros to use bits [7:6] and set bits [3:0] to +default 0x0a reserved value (according to datasheets). + +While at there, remove a write to DBLV register in +"ov7675_set_framerate()" that over-writes the previous one to the same +register that takes "info->pll_bypass" flag into account instead of setting PLL +multiplier to 4x unconditionally. + +And, while at there, since "info->pll_bypass" is only used in +set/get_framerate() functions used by ov7675 only, it is not necessary +to check for the device id at probe time to make sure that when using +ov7670 "info->pll_bypass" is set to false. + +Fixes: f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") + +Signed-off-by: Jacopo Mondi +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/i2c/ov7670.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +--- a/drivers/media/i2c/ov7670.c ++++ b/drivers/media/i2c/ov7670.c +@@ -155,10 +155,10 @@ MODULE_PARM_DESC(debug, "Debug level (0- + #define REG_GFIX 0x69 /* Fix gain control */ + + #define REG_DBLV 0x6b /* PLL control an debugging */ +-#define DBLV_BYPASS 0x00 /* Bypass PLL */ +-#define DBLV_X4 0x01 /* clock x4 */ +-#define DBLV_X6 0x10 /* clock x6 */ +-#define DBLV_X8 0x11 /* clock x8 */ ++#define DBLV_BYPASS 0x0a /* Bypass PLL */ ++#define DBLV_X4 0x4a /* clock x4 */ ++#define DBLV_X6 0x8a /* clock x6 */ ++#define DBLV_X8 0xca /* clock x8 */ + + #define REG_REG76 0x76 /* OV's name */ + #define R76_BLKPCOR 0x80 /* Black pixel correction enable */ +@@ -833,7 +833,7 @@ static int ov7675_set_framerate(struct v + if (ret < 0) + return ret; + +- return ov7670_write(sd, REG_DBLV, DBLV_X4); ++ return 0; + } + + static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, +@@ -1578,11 +1578,7 @@ static int ov7670_probe(struct i2c_clien + if (config->clock_speed) + info->clock_speed = config->clock_speed; + +- /* +- * It should be allowed for ov7670 too when it is migrated to +- * the new frame rate formula. +- */ +- if (config->pll_bypass && id->driver_data != MODEL_OV7670) ++ if (config->pll_bypass) + info->pll_bypass = true; + + if (config->pclk_hb_disable) diff --git a/queue-4.4/selinux-never-allow-relabeling-on-context-mounts.patch b/queue-4.4/selinux-never-allow-relabeling-on-context-mounts.patch new file mode 100644 index 00000000000..9a8cc0e33d0 --- /dev/null +++ b/queue-4.4/selinux-never-allow-relabeling-on-context-mounts.patch @@ -0,0 +1,83 @@ +From a83d6ddaebe541570291205cb538e35ad4ff94f9 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Fri, 21 Dec 2018 21:18:52 +0100 +Subject: selinux: never allow relabeling on context mounts + +From: Ondrej Mosnacek + +commit a83d6ddaebe541570291205cb538e35ad4ff94f9 upstream. + +In the SECURITY_FS_USE_MNTPOINT case we never want to allow relabeling +files/directories, so we should never set the SBLABEL_MNT flag. The +'special handling' in selinux_is_sblabel_mnt() is only intended for when +the behavior is set to SECURITY_FS_USE_GENFS. + +While there, make the logic in selinux_is_sblabel_mnt() more explicit +and add a BUILD_BUG_ON() to make sure that introducing a new +SECURITY_FS_USE_* forces a review of the logic. + +Fixes: d5f3a5f6e7e7 ("selinux: add security in-core xattr support for pstore and debugfs") +Signed-off-by: Ondrej Mosnacek +Reviewed-by: Stephen Smalley +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman + +--- + security/selinux/hooks.c | 40 +++++++++++++++++++++++++++++++--------- + 1 file changed, 31 insertions(+), 9 deletions(-) + +--- a/security/selinux/hooks.c ++++ b/security/selinux/hooks.c +@@ -396,21 +396,43 @@ static int may_context_mount_inode_relab + return rc; + } + +-static int selinux_is_sblabel_mnt(struct super_block *sb) ++static int selinux_is_genfs_special_handling(struct super_block *sb) + { +- struct superblock_security_struct *sbsec = sb->s_security; +- +- return sbsec->behavior == SECURITY_FS_USE_XATTR || +- sbsec->behavior == SECURITY_FS_USE_TRANS || +- sbsec->behavior == SECURITY_FS_USE_TASK || +- sbsec->behavior == SECURITY_FS_USE_NATIVE || +- /* Special handling. Genfs but also in-core setxattr handler */ +- !strcmp(sb->s_type->name, "sysfs") || ++ /* Special handling. Genfs but also in-core setxattr handler */ ++ return !strcmp(sb->s_type->name, "sysfs") || + !strcmp(sb->s_type->name, "pstore") || + !strcmp(sb->s_type->name, "debugfs") || + !strcmp(sb->s_type->name, "rootfs"); + } + ++static int selinux_is_sblabel_mnt(struct super_block *sb) ++{ ++ struct superblock_security_struct *sbsec = sb->s_security; ++ ++ /* ++ * IMPORTANT: Double-check logic in this function when adding a new ++ * SECURITY_FS_USE_* definition! ++ */ ++ BUILD_BUG_ON(SECURITY_FS_USE_MAX != 7); ++ ++ switch (sbsec->behavior) { ++ case SECURITY_FS_USE_XATTR: ++ case SECURITY_FS_USE_TRANS: ++ case SECURITY_FS_USE_TASK: ++ case SECURITY_FS_USE_NATIVE: ++ return 1; ++ ++ case SECURITY_FS_USE_GENFS: ++ return selinux_is_genfs_special_handling(sb); ++ ++ /* Never allow relabeling on context mounts */ ++ case SECURITY_FS_USE_MNTPOINT: ++ case SECURITY_FS_USE_NONE: ++ default: ++ return 0; ++ } ++} ++ + static int sb_finish_set_opts(struct super_block *sb) + { + struct superblock_security_struct *sbsec = sb->s_security; diff --git a/queue-4.4/series b/queue-4.4/series index 7e452ce8d2c..c07c33c4074 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -136,3 +136,7 @@ usb-usbip-fix-isoc-packet-num-validation-in-get_pipe.patch staging-iio-adt7316-allow-adt751x-to-use-internal-vref-for-all-dacs.patch staging-iio-adt7316-fix-the-dac-read-calculation.patch staging-iio-adt7316-fix-the-dac-write-calculation.patch +input-snvs_pwrkey-initialize-necessary-driver-data-before-enabling-irq.patch +selinux-never-allow-relabeling-on-context-mounts.patch +x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch +media-v4l2-i2c-ov7670-fix-pll-bypass-register-values.patch diff --git a/queue-4.4/x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch b/queue-4.4/x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch new file mode 100644 index 00000000000..a7cd01bb36a --- /dev/null +++ b/queue-4.4/x86-mce-improve-error-message-when-kernel-cannot-recover-p2.patch @@ -0,0 +1,50 @@ +From 41f035a86b5b72a4f947c38e94239d20d595352a Mon Sep 17 00:00:00 2001 +From: Tony Luck +Date: Mon, 25 Feb 2019 12:59:40 -0800 +Subject: x86/mce: Improve error message when kernel cannot recover, p2 + +From: Tony Luck + +commit 41f035a86b5b72a4f947c38e94239d20d595352a upstream. + +In + + c7d606f560e4 ("x86/mce: Improve error message when kernel cannot recover") + +a case was added for a machine check caused by a DATA access to poison +memory from the kernel. A case should have been added also for an +uncorrectable error during an instruction fetch in the kernel. + +Add that extra case so the error message now reads: + + mce: [Hardware Error]: Machine check: Instruction fetch error in kernel + +Fixes: c7d606f560e4 ("x86/mce: Improve error message when kernel cannot recover") +Signed-off-by: Tony Luck +Signed-off-by: Borislav Petkov +Cc: "H. Peter Anvin" +Cc: Ingo Molnar +Cc: Pu Wen +Cc: Thomas Gleixner +Cc: x86-ml +Link: https://lkml.kernel.org/r/20190225205940.15226-1-tony.luck@intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/cpu/mcheck/mce-severity.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c ++++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c +@@ -132,6 +132,11 @@ static struct severity { + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), + USER + ), ++ MCESEV( ++ PANIC, "Instruction fetch error in kernel", ++ SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), ++ KERNEL ++ ), + #endif + MCESEV( + PANIC, "Action required: unknown MCACOD", -- 2.47.2