From b3b4f69297d4c6eb896ea1fb8473dd69b5c2aa40 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 16 Jan 2020 00:08:48 +0100 Subject: [PATCH] 4.9-stable patches added patches: cifs-adjust-indentation-in-smb2_open_file.patch gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch hsr-reset-network-header-when-supervision-frame-is-created.patch iommu-remove-device-link-to-group-on-failure.patch rtc-mt6397-fix-alarm-register-overwrite.patch --- ...adjust-indentation-in-smb2_open_file.patch | 45 ++++++++ ...on-out-of-range-gpio-in-lookup-table.patch | 46 ++++++++ ...er-when-supervision-frame-is-created.patch | 58 ++++++++++ ...move-device-link-to-group-on-failure.patch | 32 ++++++ ...-mt6397-fix-alarm-register-overwrite.patch | 103 ++++++++++++++++++ queue-4.9/series | 5 + 6 files changed, 289 insertions(+) create mode 100644 queue-4.9/cifs-adjust-indentation-in-smb2_open_file.patch create mode 100644 queue-4.9/gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch create mode 100644 queue-4.9/hsr-reset-network-header-when-supervision-frame-is-created.patch create mode 100644 queue-4.9/iommu-remove-device-link-to-group-on-failure.patch create mode 100644 queue-4.9/rtc-mt6397-fix-alarm-register-overwrite.patch diff --git a/queue-4.9/cifs-adjust-indentation-in-smb2_open_file.patch b/queue-4.9/cifs-adjust-indentation-in-smb2_open_file.patch new file mode 100644 index 00000000000..0f0dd570968 --- /dev/null +++ b/queue-4.9/cifs-adjust-indentation-in-smb2_open_file.patch @@ -0,0 +1,45 @@ +From 7935799e041ae10d380d04ea23868240f082bd11 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Tue, 17 Dec 2019 20:04:51 -0700 +Subject: cifs: Adjust indentation in smb2_open_file + +From: Nathan Chancellor + +commit 7935799e041ae10d380d04ea23868240f082bd11 upstream. + +Clang warns: + +../fs/cifs/smb2file.c:70:3: warning: misleading indentation; statement +is not part of the previous 'if' [-Wmisleading-indentation] + if (oparms->tcon->use_resilient) { + ^ +../fs/cifs/smb2file.c:66:2: note: previous statement is here + if (rc) + ^ +1 warning generated. + +This warning occurs because there is a space after the tab on this line. +Remove it so that the indentation is consistent with the Linux kernel +coding style and clang no longer warns. + +Fixes: 592fafe644bf ("Add resilienthandles mount parm") +Link: https://github.com/ClangBuiltLinux/linux/issues/826 +Signed-off-by: Nathan Chancellor +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/smb2file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, s + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ + nr_ioctl_req.Reserved = 0; + rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, diff --git a/queue-4.9/gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch b/queue-4.9/gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch new file mode 100644 index 00000000000..0ec0e0686c7 --- /dev/null +++ b/queue-4.9/gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch @@ -0,0 +1,46 @@ +From d935bd50dd14a7714cbdba9a76435dbb56edb1ae Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Wed, 27 Nov 2019 10:59:19 +0100 +Subject: gpio: Fix error message on out-of-range GPIO in lookup table + +From: Geert Uytterhoeven + +commit d935bd50dd14a7714cbdba9a76435dbb56edb1ae upstream. + +When a GPIO offset in a lookup table is out-of-range, the printed error +message (1) does not include the actual out-of-range value, and (2) +contains an off-by-one error in the upper bound. + +Avoid user confusion by also printing the actual GPIO offset, and +correcting the upper bound of the range. +While at it, use "%u" for unsigned int. + +Sample impact: + + -requested GPIO 0 is out of range [0..32] for chip e6052000.gpio + +requested GPIO 0 (45) is out of range [0..31] for chip e6052000.gpio + +Fixes: 2a3cf6a3599e9015 ("gpiolib: return -ENOENT if no GPIO mapping exists") +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20191127095919.4214-1-geert+renesas@glider.be +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -3049,8 +3049,9 @@ static struct gpio_desc *gpiod_find(stru + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + diff --git a/queue-4.9/hsr-reset-network-header-when-supervision-frame-is-created.patch b/queue-4.9/hsr-reset-network-header-when-supervision-frame-is-created.patch new file mode 100644 index 00000000000..a947bcc2e8a --- /dev/null +++ b/queue-4.9/hsr-reset-network-header-when-supervision-frame-is-created.patch @@ -0,0 +1,58 @@ +From 3ed0a1d563903bdb4b4c36c58c4d9c1bcb23a6e6 Mon Sep 17 00:00:00 2001 +From: Taehee Yoo +Date: Sun, 22 Dec 2019 11:27:08 +0000 +Subject: hsr: reset network header when supervision frame is created + +From: Taehee Yoo + +commit 3ed0a1d563903bdb4b4c36c58c4d9c1bcb23a6e6 upstream. + +The supervision frame is L2 frame. +When supervision frame is created, hsr module doesn't set network header. +If tap routine is enabled, dev_queue_xmit_nit() is called and it checks +network_header. If network_header pointer wasn't set(or invalid), +it resets network_header and warns. +In order to avoid unnecessary warning message, resetting network_header +is needed. + +Test commands: + ip netns add nst + ip link add veth0 type veth peer name veth1 + ip link add veth2 type veth peer name veth3 + ip link set veth1 netns nst + ip link set veth3 netns nst + ip link set veth0 up + ip link set veth2 up + ip link add hsr0 type hsr slave1 veth0 slave2 veth2 + ip a a 192.168.100.1/24 dev hsr0 + ip link set hsr0 up + ip netns exec nst ip link set veth1 up + ip netns exec nst ip link set veth3 up + ip netns exec nst ip link add hsr1 type hsr slave1 veth1 slave2 veth3 + ip netns exec nst ip a a 192.168.100.2/24 dev hsr1 + ip netns exec nst ip link set hsr1 up + tcpdump -nei veth0 + +Splat looks like: +[ 175.852292][ C3] protocol 88fb is buggy, dev veth0 + +Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)") +Signed-off-by: Taehee Yoo +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + net/hsr/hsr_device.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -281,6 +281,8 @@ static void send_hsr_supervision_frame(s + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + if (hsrVer > 0) { + hsr_tag = (typeof(hsr_tag)) skb_put(skb, sizeof(struct hsr_tag)); diff --git a/queue-4.9/iommu-remove-device-link-to-group-on-failure.patch b/queue-4.9/iommu-remove-device-link-to-group-on-failure.patch new file mode 100644 index 00000000000..d2c164f02e6 --- /dev/null +++ b/queue-4.9/iommu-remove-device-link-to-group-on-failure.patch @@ -0,0 +1,32 @@ +From 7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4 Mon Sep 17 00:00:00 2001 +From: Jon Derrick +Date: Tue, 31 Dec 2019 13:24:19 -0700 +Subject: iommu: Remove device link to group on failure + +From: Jon Derrick + +commit 7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4 upstream. + +This adds the missing teardown step that removes the device link from +the group when the device addition fails. + +Signed-off-by: Jon Derrick +Fixes: 797a8b4d768c5 ("iommu: Handle default domain attach failure") +Reviewed-by: Lu Baolu +Signed-off-by: Joerg Roedel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iommu/iommu.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -439,6 +439,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: diff --git a/queue-4.9/rtc-mt6397-fix-alarm-register-overwrite.patch b/queue-4.9/rtc-mt6397-fix-alarm-register-overwrite.patch new file mode 100644 index 00000000000..952406071ca --- /dev/null +++ b/queue-4.9/rtc-mt6397-fix-alarm-register-overwrite.patch @@ -0,0 +1,103 @@ +From 653997eeecef95c3ead4fba1b2d27e6a5854d6cd Mon Sep 17 00:00:00 2001 +From: Ran Bi +Date: Wed, 11 Dec 2019 17:43:54 +0800 +Subject: rtc: mt6397: fix alarm register overwrite + +From: Ran Bi + +commit 653997eeecef95c3ead4fba1b2d27e6a5854d6cd upstream. + +Alarm registers high byte was reserved for other functions. +This add mask in alarm registers operation functions. +This also fix error condition in interrupt handler. + +Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver") + +Signed-off-by: Ran Bi +Signed-off-by: Hsin-Hsiung Wang +Link: https://lore.kernel.org/r/1576057435-3561-6-git-send-email-hsin-hsiung.wang@mediatek.com +Signed-off-by: Alexandre Belloni +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-mt6397.c | 47 +++++++++++++++++++++++++++++++++-------------- + 1 file changed, 33 insertions(+), 14 deletions(-) + +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -55,6 +55,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_t + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct dev + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct devi + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, diff --git a/queue-4.9/series b/queue-4.9/series index ff9fd69215f..4df6f463e84 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -17,3 +17,8 @@ wimax-i2400-fix-memory-leak-in-i2400m_op_rfkill_sw_toggle.patch ext4-fix-use-after-free-race-with-debug_want_extra_isize.patch ext4-add-more-paranoia-checking-in-ext4_expand_extra_isize-handling.patch dccp-fix-memleak-in-__feat_register_sp.patch +rtc-mt6397-fix-alarm-register-overwrite.patch +iommu-remove-device-link-to-group-on-failure.patch +gpio-fix-error-message-on-out-of-range-gpio-in-lookup-table.patch +hsr-reset-network-header-when-supervision-frame-is-created.patch +cifs-adjust-indentation-in-smb2_open_file.patch -- 2.47.3