From 2f168cf391c8f615a95ab7d5264db880b225ab22 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 6 Jan 2021 17:58:20 +0100 Subject: [PATCH] 5.10-stable patches added patches: bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch dt-bindings-rtc-add-reset-source-property.patch kdev_t-always-inline-major-minor-helper-functions.patch revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch revert-mtd-spinand-fix-oob-read.patch rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch --- ...-to-set-rpa-timeout-when-unsupported.patch | 51 ++++++++ ...ndings-rtc-add-reset-source-property.patch | 41 +++++++ ...-inline-major-minor-helper-functions.patch | 104 ++++++++++++++++ ...isplay-fix-memory-leaks-in-s3-resume.patch | 40 ++++++ .../revert-mtd-spinand-fix-oob-read.patch | 38 ++++++ ...nitialisation-to-a-separate-function.patch | 116 ++++++++++++++++++ ...e-watchdog-when-explicitly-available.patch | 43 +++++++ queue-5.10/series | 5 + 8 files changed, 438 insertions(+) create mode 100644 queue-5.10/bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch create mode 100644 queue-5.10/dt-bindings-rtc-add-reset-source-property.patch create mode 100644 queue-5.10/kdev_t-always-inline-major-minor-helper-functions.patch create mode 100644 queue-5.10/revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch create mode 100644 queue-5.10/revert-mtd-spinand-fix-oob-read.patch create mode 100644 queue-5.10/rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch create mode 100644 queue-5.10/rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch diff --git a/queue-5.10/bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch b/queue-5.10/bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch new file mode 100644 index 00000000000..bf8207beb5a --- /dev/null +++ b/queue-5.10/bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch @@ -0,0 +1,51 @@ +From a31489d2a368d2f9225ed6a6f595c63bc7d10de8 Mon Sep 17 00:00:00 2001 +From: Edward Vear +Date: Tue, 27 Oct 2020 00:02:03 -0700 +Subject: Bluetooth: Fix attempting to set RPA timeout when unsupported + +From: Edward Vear + +commit a31489d2a368d2f9225ed6a6f595c63bc7d10de8 upstream. + +During controller initialization, an LE Set RPA Timeout command is sent +to the controller if supported. However, the value checked to determine +if the command is supported is incorrect. Page 1921 of the Bluetooth +Core Spec v5.2 shows that bit 2 of octet 35 of the Supported_Commands +field corresponds to the LE Set RPA Timeout command, but currently +bit 6 of octet 35 is checked. This patch checks the correct value +instead. + +This issue led to the error seen in the following btmon output during +initialization of an adapter (rtl8761b) and prevented initialization +from completing. + +< HCI Command: LE Set Resolvable Private Address Timeout (0x08|0x002e) plen 2 + Timeout: 900 seconds +> HCI Event: Command Complete (0x0e) plen 4 + LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 2 + Status: Unsupported Remote Feature / Unsupported LMP Feature (0x1a) += Close Index: 00:E0:4C:6B:E5:03 + +The error did not appear when running with this patch. + +Signed-off-by: Edward Vear +Signed-off-by: Marcel Holtmann +Signed-off-by: Johan Hedberg +Cc: Sudip Mukherjee +Signed-off-by: Greg Kroah-Hartman + +--- + net/bluetooth/hci_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -763,7 +763,7 @@ static int hci_init3_req(struct hci_requ + hci_req_add(req, HCI_OP_LE_CLEAR_RESOLV_LIST, 0, NULL); + } + +- if (hdev->commands[35] & 0x40) { ++ if (hdev->commands[35] & 0x04) { + __le16 rpa_timeout = cpu_to_le16(hdev->rpa_timeout); + + /* Set RPA timeout */ diff --git a/queue-5.10/dt-bindings-rtc-add-reset-source-property.patch b/queue-5.10/dt-bindings-rtc-add-reset-source-property.patch new file mode 100644 index 00000000000..84d5c23a81d --- /dev/null +++ b/queue-5.10/dt-bindings-rtc-add-reset-source-property.patch @@ -0,0 +1,41 @@ +From 320d159e2d63a97a40f24cd6dfda5a57eec65b91 Mon Sep 17 00:00:00 2001 +From: Rasmus Villemoes +Date: Fri, 18 Dec 2020 11:10:53 +0100 +Subject: dt-bindings: rtc: add reset-source property + +From: Rasmus Villemoes + +commit 320d159e2d63a97a40f24cd6dfda5a57eec65b91 upstream. + +Some RTCs, e.g. the pcf2127, can be used as a hardware watchdog. But +if the reset pin is not actually wired up, the driver exposes a +watchdog device that doesn't actually work. + +Provide a standard binding that can be used to indicate that a given +RTC can perform a reset of the machine, similar to wakeup-source. + +Suggested-by: Alexandre Belloni +Signed-off-by: Rasmus Villemoes +Reviewed-by: Rob Herring +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20201218101054.25416-2-rasmus.villemoes@prevas.dk +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/devicetree/bindings/rtc/rtc.yaml | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/Documentation/devicetree/bindings/rtc/rtc.yaml ++++ b/Documentation/devicetree/bindings/rtc/rtc.yaml +@@ -63,6 +63,11 @@ properties: + description: + Enables wake up of host system on alarm. + ++ reset-source: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: ++ The RTC is able to reset the machine. ++ + additionalProperties: true + + ... diff --git a/queue-5.10/kdev_t-always-inline-major-minor-helper-functions.patch b/queue-5.10/kdev_t-always-inline-major-minor-helper-functions.patch new file mode 100644 index 00000000000..79ddd024fd6 --- /dev/null +++ b/queue-5.10/kdev_t-always-inline-major-minor-helper-functions.patch @@ -0,0 +1,104 @@ +From aa8c7db494d0a83ecae583aa193f1134ef25d506 Mon Sep 17 00:00:00 2001 +From: Josh Poimboeuf +Date: Tue, 29 Dec 2020 15:14:55 -0800 +Subject: kdev_t: always inline major/minor helper functions + +From: Josh Poimboeuf + +commit aa8c7db494d0a83ecae583aa193f1134ef25d506 upstream. + +Silly GCC doesn't always inline these trivial functions. + +Fixes the following warning: + + arch/x86/kernel/sys_ia32.o: warning: objtool: cp_stat64()+0xd8: call to new_encode_dev() with UACCESS enabled + +Link: https://lkml.kernel.org/r/984353b44a4484d86ba9f73884b7306232e25e30.1608737428.git.jpoimboe@redhat.com +Signed-off-by: Josh Poimboeuf +Reported-by: Randy Dunlap +Acked-by: Randy Dunlap [build-tested] +Cc: Peter Zijlstra +Cc: Greg Kroah-Hartman +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/kdev_t.h | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +--- a/include/linux/kdev_t.h ++++ b/include/linux/kdev_t.h +@@ -21,61 +21,61 @@ + }) + + /* acceptable for old filesystems */ +-static inline bool old_valid_dev(dev_t dev) ++static __always_inline bool old_valid_dev(dev_t dev) + { + return MAJOR(dev) < 256 && MINOR(dev) < 256; + } + +-static inline u16 old_encode_dev(dev_t dev) ++static __always_inline u16 old_encode_dev(dev_t dev) + { + return (MAJOR(dev) << 8) | MINOR(dev); + } + +-static inline dev_t old_decode_dev(u16 val) ++static __always_inline dev_t old_decode_dev(u16 val) + { + return MKDEV((val >> 8) & 255, val & 255); + } + +-static inline u32 new_encode_dev(dev_t dev) ++static __always_inline u32 new_encode_dev(dev_t dev) + { + unsigned major = MAJOR(dev); + unsigned minor = MINOR(dev); + return (minor & 0xff) | (major << 8) | ((minor & ~0xff) << 12); + } + +-static inline dev_t new_decode_dev(u32 dev) ++static __always_inline dev_t new_decode_dev(u32 dev) + { + unsigned major = (dev & 0xfff00) >> 8; + unsigned minor = (dev & 0xff) | ((dev >> 12) & 0xfff00); + return MKDEV(major, minor); + } + +-static inline u64 huge_encode_dev(dev_t dev) ++static __always_inline u64 huge_encode_dev(dev_t dev) + { + return new_encode_dev(dev); + } + +-static inline dev_t huge_decode_dev(u64 dev) ++static __always_inline dev_t huge_decode_dev(u64 dev) + { + return new_decode_dev(dev); + } + +-static inline int sysv_valid_dev(dev_t dev) ++static __always_inline int sysv_valid_dev(dev_t dev) + { + return MAJOR(dev) < (1<<14) && MINOR(dev) < (1<<18); + } + +-static inline u32 sysv_encode_dev(dev_t dev) ++static __always_inline u32 sysv_encode_dev(dev_t dev) + { + return MINOR(dev) | (MAJOR(dev) << 18); + } + +-static inline unsigned sysv_major(u32 dev) ++static __always_inline unsigned sysv_major(u32 dev) + { + return (dev >> 18) & 0x3fff; + } + +-static inline unsigned sysv_minor(u32 dev) ++static __always_inline unsigned sysv_minor(u32 dev) + { + return dev & 0x3ffff; + } diff --git a/queue-5.10/revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch b/queue-5.10/revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch new file mode 100644 index 00000000000..5e5c2bb1538 --- /dev/null +++ b/queue-5.10/revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch @@ -0,0 +1,40 @@ +From alexdeucher@gmail.com Wed Jan 6 17:47:17 2021 +From: Alex Deucher +Date: Tue, 5 Jan 2021 11:45:45 -0500 +Subject: Revert "drm/amd/display: Fix memory leaks in S3 resume" +To: amd-gfx@lists.freedesktop.org +Cc: Alex Deucher , Stylon Wang , Harry Wentland , Nicholas Kazlauskas , Andre Tomt , Oleksandr Natalenko , stable@vger.kernel.org +Message-ID: <20210105164545.963036-1-alexander.deucher@amd.com> + +From: Alex Deucher + +This reverts commit a135a1b4c4db1f3b8cbed9676a40ede39feb3362. + +This leads to blank screens on some boards after replugging a +display. Revert until we understand the root cause and can +fix both the leak and the blank screen after replug. + +Cc: Stylon Wang +Cc: Harry Wentland +Cc: Nicholas Kazlauskas +Cc: Andre Tomt +Cc: Oleksandr Natalenko +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -2278,8 +2278,7 @@ void amdgpu_dm_update_connector_after_de + + drm_connector_update_edid_property(connector, + aconnector->edid); +- aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid); +- drm_connector_list_update(connector); ++ drm_add_edid_modes(connector, aconnector->edid); + + if (aconnector->dc_link->aux_mode) + drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux, diff --git a/queue-5.10/revert-mtd-spinand-fix-oob-read.patch b/queue-5.10/revert-mtd-spinand-fix-oob-read.patch new file mode 100644 index 00000000000..b5c20771652 --- /dev/null +++ b/queue-5.10/revert-mtd-spinand-fix-oob-read.patch @@ -0,0 +1,38 @@ +From nbd@nbd.name Wed Jan 6 17:49:44 2021 +From: Felix Fietkau +Date: Tue, 5 Jan 2021 11:18:21 +0100 +Subject: Revert "mtd: spinand: Fix OOB read" +To: stable@vger.kernel.org +Cc: gregkh@linuxfoundation.org, Miquel Raynal +Message-ID: <20210105101821.47138-1-nbd@nbd.name> + +From: Felix Fietkau + +This reverts stable commit baad618d078c857f99cc286ea249e9629159901f. + +This commit is adding lines to spinand_write_to_cache_op, wheras the upstream +commit 868cbe2a6dcee451bd8f87cbbb2a73cf463b57e5 that this was supposed to +backport was touching spinand_read_from_cache_op. +It causes a crash on writing OOB data by attempting to write to read-only +kernel memory. + +Cc: Miquel Raynal +Signed-off-by: Felix Fietkau +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mtd/nand/spi/core.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/drivers/mtd/nand/spi/core.c ++++ b/drivers/mtd/nand/spi/core.c +@@ -318,10 +318,6 @@ static int spinand_write_to_cache_op(str + buf += ret; + } + +- if (req->ooblen) +- memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, +- req->ooblen); +- + return 0; + } + diff --git a/queue-5.10/rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch b/queue-5.10/rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch new file mode 100644 index 00000000000..76cf4b71d7d --- /dev/null +++ b/queue-5.10/rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch @@ -0,0 +1,116 @@ +From 5d78533a0c53af9659227c803df944ba27cd56e0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Thu, 24 Sep 2020 12:52:55 +0200 +Subject: rtc: pcf2127: move watchdog initialisation to a separate function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 5d78533a0c53af9659227c803df944ba27cd56e0 upstream. + +The obvious advantages are: + + - The linker can drop the watchdog functions if CONFIG_WATCHDOG is off. + - All watchdog stuff grouped together with only a single function call + left in generic code. + - Watchdog register is only read when it is actually used. + - Less #ifdefery + +Signed-off-by: Uwe Kleine-König +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20200924105256.18162-2-u.kleine-koenig@pengutronix.de +Cc: Rasmus Villemoes +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-pcf2127.c | 56 +++++++++++++++++++++++++--------------------- + 1 file changed, 31 insertions(+), 25 deletions(-) + +--- a/drivers/rtc/rtc-pcf2127.c ++++ b/drivers/rtc/rtc-pcf2127.c +@@ -331,6 +331,36 @@ static const struct watchdog_ops pcf2127 + .set_timeout = pcf2127_wdt_set_timeout, + }; + ++static int pcf2127_watchdog_init(struct device *dev, struct pcf2127 *pcf2127) ++{ ++ u32 wdd_timeout; ++ int ret; ++ ++ if (!IS_ENABLED(CONFIG_WATCHDOG)) ++ return 0; ++ ++ pcf2127->wdd.parent = dev; ++ pcf2127->wdd.info = &pcf2127_wdt_info; ++ pcf2127->wdd.ops = &pcf2127_watchdog_ops; ++ pcf2127->wdd.min_timeout = PCF2127_WD_VAL_MIN; ++ pcf2127->wdd.max_timeout = PCF2127_WD_VAL_MAX; ++ pcf2127->wdd.timeout = PCF2127_WD_VAL_DEFAULT; ++ pcf2127->wdd.min_hw_heartbeat_ms = 500; ++ pcf2127->wdd.status = WATCHDOG_NOWAYOUT_INIT_STATUS; ++ ++ watchdog_set_drvdata(&pcf2127->wdd, pcf2127); ++ ++ /* Test if watchdog timer is started by bootloader */ ++ ret = regmap_read(pcf2127->regmap, PCF2127_REG_WD_VAL, &wdd_timeout); ++ if (ret) ++ return ret; ++ ++ if (wdd_timeout) ++ set_bit(WDOG_HW_RUNNING, &pcf2127->wdd.status); ++ ++ return devm_watchdog_register_device(dev, &pcf2127->wdd); ++} ++ + /* Alarm */ + static int pcf2127_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) + { +@@ -532,7 +562,6 @@ static int pcf2127_probe(struct device * + int alarm_irq, const char *name, bool has_nvmem) + { + struct pcf2127 *pcf2127; +- u32 wdd_timeout; + int ret = 0; + + dev_dbg(dev, "%s\n", __func__); +@@ -571,17 +600,6 @@ static int pcf2127_probe(struct device * + pcf2127->rtc->ops = &pcf2127_rtc_alrm_ops; + } + +- pcf2127->wdd.parent = dev; +- pcf2127->wdd.info = &pcf2127_wdt_info; +- pcf2127->wdd.ops = &pcf2127_watchdog_ops; +- pcf2127->wdd.min_timeout = PCF2127_WD_VAL_MIN; +- pcf2127->wdd.max_timeout = PCF2127_WD_VAL_MAX; +- pcf2127->wdd.timeout = PCF2127_WD_VAL_DEFAULT; +- pcf2127->wdd.min_hw_heartbeat_ms = 500; +- pcf2127->wdd.status = WATCHDOG_NOWAYOUT_INIT_STATUS; +- +- watchdog_set_drvdata(&pcf2127->wdd, pcf2127); +- + if (has_nvmem) { + struct nvmem_config nvmem_cfg = { + .priv = pcf2127, +@@ -611,19 +629,7 @@ static int pcf2127_probe(struct device * + return ret; + } + +- /* Test if watchdog timer is started by bootloader */ +- ret = regmap_read(pcf2127->regmap, PCF2127_REG_WD_VAL, &wdd_timeout); +- if (ret) +- return ret; +- +- if (wdd_timeout) +- set_bit(WDOG_HW_RUNNING, &pcf2127->wdd.status); +- +-#ifdef CONFIG_WATCHDOG +- ret = devm_watchdog_register_device(dev, &pcf2127->wdd); +- if (ret) +- return ret; +-#endif /* CONFIG_WATCHDOG */ ++ pcf2127_watchdog_init(dev, pcf2127); + + /* + * Disable battery low/switch-over timestamp and interrupts. diff --git a/queue-5.10/rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch b/queue-5.10/rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch new file mode 100644 index 00000000000..1bad6b88c32 --- /dev/null +++ b/queue-5.10/rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch @@ -0,0 +1,43 @@ +From 71ac13457d9d1007effde65b54818106b2c2b525 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Fri, 18 Dec 2020 11:10:54 +0100 +Subject: rtc: pcf2127: only use watchdog when explicitly available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 71ac13457d9d1007effde65b54818106b2c2b525 upstream. + +Most boards using the pcf2127 chip (in my bubble) don't make use of the +watchdog functionality and the respective output is not connected. The +effect on such a board is that there is a watchdog device provided that +doesn't work. + +So only register the watchdog if the device tree has a "reset-source" +property. + +Signed-off-by: Uwe Kleine-König +[RV: s/has-watchdog/reset-source/] +Signed-off-by: Rasmus Villemoes +Signed-off-by: Alexandre Belloni +Link: https://lore.kernel.org/r/20201218101054.25416-3-rasmus.villemoes@prevas.dk +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-pcf2127.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/rtc/rtc-pcf2127.c ++++ b/drivers/rtc/rtc-pcf2127.c +@@ -336,7 +336,8 @@ static int pcf2127_watchdog_init(struct + u32 wdd_timeout; + int ret; + +- if (!IS_ENABLED(CONFIG_WATCHDOG)) ++ if (!IS_ENABLED(CONFIG_WATCHDOG) || ++ !device_property_read_bool(dev, "reset-source")) + return 0; + + pcf2127->wdd.parent = dev; diff --git a/queue-5.10/series b/queue-5.10/series index 9c03404433e..8459818d8bd 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1,2 +1,7 @@ revert-drm-amd-display-fix-memory-leaks-in-s3-resume.patch revert-mtd-spinand-fix-oob-read.patch +rtc-pcf2127-move-watchdog-initialisation-to-a-separate-function.patch +rtc-pcf2127-only-use-watchdog-when-explicitly-available.patch +dt-bindings-rtc-add-reset-source-property.patch +kdev_t-always-inline-major-minor-helper-functions.patch +bluetooth-fix-attempting-to-set-rpa-timeout-when-unsupported.patch -- 2.47.3