From: Sasha Levin Date: Wed, 18 Mar 2020 20:57:35 +0000 (-0400) Subject: Fixes for 4.14 X-Git-Tag: v4.4.217~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cff4d98db5882bf60d375c0e94eafc06dae3bcbb;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/acpi-watchdog-allow-disabling-wdat-at-boot.patch b/queue-4.14/acpi-watchdog-allow-disabling-wdat-at-boot.patch new file mode 100644 index 00000000000..c3ec2b12f9c --- /dev/null +++ b/queue-4.14/acpi-watchdog-allow-disabling-wdat-at-boot.patch @@ -0,0 +1,74 @@ +From cee9208c449064bd6f49983a0f07a3b9b7cdf196 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Feb 2020 16:58:45 +0100 +Subject: ACPI: watchdog: Allow disabling WDAT at boot + +From: Jean Delvare + +[ Upstream commit 3f9e12e0df012c4a9a7fd7eb0d3ae69b459d6b2c ] + +In case the WDAT interface is broken, give the user an option to +ignore it to let a native driver bind to the watchdog device instead. + +Signed-off-by: Jean Delvare +Acked-by: Mika Westerberg +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + Documentation/admin-guide/kernel-parameters.txt | 4 ++++ + drivers/acpi/acpi_watchdog.c | 12 +++++++++++- + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 7e0a4be3503d6..ae51b1b7b67fb 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -137,6 +137,10 @@ + dynamic table installation which will install SSDT + tables to /sys/firmware/acpi/tables/dynamic. + ++ acpi_no_watchdog [HW,ACPI,WDT] ++ Ignore the ACPI-based watchdog interface (WDAT) and let ++ a native driver control the watchdog device instead. ++ + acpi_rsdp= [ACPI,EFI,KEXEC] + Pass the RSDP address to the kernel, mostly used + on machines running EFI runtime service to boot the +diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c +index 23cde3d8e8fbb..0bd1899a287f3 100644 +--- a/drivers/acpi/acpi_watchdog.c ++++ b/drivers/acpi/acpi_watchdog.c +@@ -58,12 +58,14 @@ static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) + } + #endif + ++static bool acpi_no_watchdog; ++ + static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) + { + const struct acpi_table_wdat *wdat = NULL; + acpi_status status; + +- if (acpi_disabled) ++ if (acpi_disabled || acpi_no_watchdog) + return NULL; + + status = acpi_get_table(ACPI_SIG_WDAT, 0, +@@ -91,6 +93,14 @@ bool acpi_has_watchdog(void) + } + EXPORT_SYMBOL_GPL(acpi_has_watchdog); + ++/* ACPI watchdog can be disabled on boot command line */ ++static int __init disable_acpi_watchdog(char *str) ++{ ++ acpi_no_watchdog = true; ++ return 1; ++} ++__setup("acpi_no_watchdog", disable_acpi_watchdog); ++ + void __init acpi_watchdog_init(void) + { + const struct acpi_wdat_entry *entries; +-- +2.20.1 + diff --git a/queue-4.14/cfg80211-check-reg_rule-for-null-in-handle_channel_c.patch b/queue-4.14/cfg80211-check-reg_rule-for-null-in-handle_channel_c.patch new file mode 100644 index 00000000000..bc88d17dadd --- /dev/null +++ b/queue-4.14/cfg80211-check-reg_rule-for-null-in-handle_channel_c.patch @@ -0,0 +1,37 @@ +From 961b51cabc6d4fc216b03d4479d5eb6998059031 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Feb 2020 10:44:50 +0100 +Subject: cfg80211: check reg_rule for NULL in handle_channel_custom() + +From: Johannes Berg + +[ Upstream commit a7ee7d44b57c9ae174088e53a668852b7f4f452d ] + +We may end up with a NULL reg_rule after the loop in +handle_channel_custom() if the bandwidth didn't fit, +check if this is the case and bail out if so. + +Signed-off-by: Johannes Berg +Link: https://lore.kernel.org/r/20200221104449.3b558a50201c.I4ad3725c4dacaefd2d18d3cc65ba6d18acd5dbfe@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/reg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/wireless/reg.c b/net/wireless/reg.c +index a520f433d4765..b95d1c2bdef7e 100644 +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -1733,7 +1733,7 @@ static void handle_channel_custom(struct wiphy *wiphy, + break; + } + +- if (IS_ERR(reg_rule)) { ++ if (IS_ERR_OR_NULL(reg_rule)) { + pr_debug("Disabling freq %d MHz as custom regd has no rule that fits it\n", + chan->center_freq); + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { +-- +2.20.1 + diff --git a/queue-4.14/hid-apple-add-support-for-recent-firmware-on-magic-k.patch b/queue-4.14/hid-apple-add-support-for-recent-firmware-on-magic-k.patch new file mode 100644 index 00000000000..073ba1f8c37 --- /dev/null +++ b/queue-4.14/hid-apple-add-support-for-recent-firmware-on-magic-k.patch @@ -0,0 +1,37 @@ +From b9a3fc91351cc94e8a737fabe38a8494988fb9ad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jan 2020 17:26:31 +1100 +Subject: HID: apple: Add support for recent firmware on Magic Keyboards + +From: Mansour Behabadi + +[ Upstream commit e433be929e63265b7412478eb7ff271467aee2d7 ] + +Magic Keyboards with more recent firmware (0x0100) report Fn key differently. +Without this patch, Fn key may not behave as expected and may not be +configurable via hid_apple fnmode module parameter. + +Signed-off-by: Mansour Behabadi +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-apple.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c +index d0a81a03ddbdd..8ab8f2350bbcd 100644 +--- a/drivers/hid/hid-apple.c ++++ b/drivers/hid/hid-apple.c +@@ -343,7 +343,8 @@ static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi, + unsigned long **bit, int *max) + { + if (usage->hid == (HID_UP_CUSTOM | 0x0003) || +- usage->hid == (HID_UP_MSVENDOR | 0x0003)) { ++ usage->hid == (HID_UP_MSVENDOR | 0x0003) || ++ usage->hid == (HID_UP_HPVENDOR2 | 0x0003)) { + /* The fn key on Apple USB keyboards */ + set_bit(EV_REP, hi->input->evbit); + hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN); +-- +2.20.1 + diff --git a/queue-4.14/hid-i2c-hid-add-trekstor-surfbook-e11b-to-descriptor.patch b/queue-4.14/hid-i2c-hid-add-trekstor-surfbook-e11b-to-descriptor.patch new file mode 100644 index 00000000000..f2a4e6a0c0d --- /dev/null +++ b/queue-4.14/hid-i2c-hid-add-trekstor-surfbook-e11b-to-descriptor.patch @@ -0,0 +1,43 @@ +From fec66b1db4c76136cc25412097570f2486f083f4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 Feb 2020 14:53:07 +0800 +Subject: HID: i2c-hid: add Trekstor Surfbook E11B to descriptor override + +From: Kai-Heng Feng + +[ Upstream commit be0aba826c4a6ba5929def1962a90d6127871969 ] + +The Surfbook E11B uses the SIPODEV SP1064 touchpad, which does not supply +descriptors, so it has to be added to the override list. + +BugLink: https://bugs.launchpad.net/bugs/1858299 +Signed-off-by: Kai-Heng Feng +Reviewed-by: Hans de Goede +Signed-off-by: Benjamin Tissoires +Signed-off-by: Sasha Levin +--- + drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +index 10af8585c820d..95052373a8282 100644 +--- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +@@ -341,6 +341,14 @@ static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { + }, + .driver_data = (void *)&sipodev_desc + }, ++ { ++ .ident = "Trekstor SURFBOOK E11B", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SURFBOOK E11B"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, + { + .ident = "Direkt-Tek DTLAPY116-2", + .matches = { +-- +2.20.1 + diff --git a/queue-4.14/hinic-fix-a-bug-of-setting-hw_ioctxt.patch b/queue-4.14/hinic-fix-a-bug-of-setting-hw_ioctxt.patch new file mode 100644 index 00000000000..6b1076fb9b7 --- /dev/null +++ b/queue-4.14/hinic-fix-a-bug-of-setting-hw_ioctxt.patch @@ -0,0 +1,63 @@ +From f7b2bd26cb823464bd06ea66259a0982e069640e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2020 06:34:43 +0000 +Subject: hinic: fix a bug of setting hw_ioctxt + +From: Luo bin + +[ Upstream commit d2ed69ce9ed3477e2a9527e6b89fe4689d99510e ] + +a reserved field is used to signify prime physical function index +in the latest firmware version, so we must assign a value to it +correctly + +Signed-off-by: Luo bin +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c | 1 + + drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h | 2 +- + drivers/net/ethernet/huawei/hinic/hinic_hw_if.h | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +index 79b5674470842..46aba02b8672b 100644 +--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c ++++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +@@ -312,6 +312,7 @@ static int set_hw_ioctxt(struct hinic_hwdev *hwdev, unsigned int rq_depth, + } + + hw_ioctxt.func_idx = HINIC_HWIF_FUNC_IDX(hwif); ++ hw_ioctxt.ppf_idx = HINIC_HWIF_PPF_IDX(hwif); + + hw_ioctxt.set_cmdq_depth = HW_IOCTXT_SET_CMDQ_DEPTH_DEFAULT; + hw_ioctxt.cmdq_depth = 0; +diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +index 0f5563f3b7798..a011fd2d26270 100644 +--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h ++++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +@@ -104,8 +104,8 @@ struct hinic_cmd_hw_ioctxt { + + u8 rsvd2; + u8 rsvd3; ++ u8 ppf_idx; + u8 rsvd4; +- u8 rsvd5; + + u16 rq_depth; + u16 rx_buf_sz_idx; +diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_if.h b/drivers/net/ethernet/huawei/hinic/hinic_hw_if.h +index 5b4760c0e9f53..f683ccbdfca02 100644 +--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_if.h ++++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_if.h +@@ -146,6 +146,7 @@ + #define HINIC_HWIF_FUNC_IDX(hwif) ((hwif)->attr.func_idx) + #define HINIC_HWIF_PCI_INTF(hwif) ((hwif)->attr.pci_intf_idx) + #define HINIC_HWIF_PF_IDX(hwif) ((hwif)->attr.pf_idx) ++#define HINIC_HWIF_PPF_IDX(hwif) ((hwif)->attr.ppf_idx) + + #define HINIC_FUNC_TYPE(hwif) ((hwif)->attr.func_type) + #define HINIC_IS_PF(hwif) (HINIC_FUNC_TYPE(hwif) == HINIC_PF) +-- +2.20.1 + diff --git a/queue-4.14/jbd2-fix-data-races-at-struct-journal_head.patch b/queue-4.14/jbd2-fix-data-races-at-struct-journal_head.patch new file mode 100644 index 00000000000..ed8ca91c77e --- /dev/null +++ b/queue-4.14/jbd2-fix-data-races-at-struct-journal_head.patch @@ -0,0 +1,110 @@ +From ffd904c00eec1269942ed8d7d5e7d22619ff8cd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Feb 2020 23:31:11 -0500 +Subject: jbd2: fix data races at struct journal_head + +From: Qian Cai + +[ Upstream commit 6c5d911249290f41f7b50b43344a7520605b1acb ] + +journal_head::b_transaction and journal_head::b_next_transaction could +be accessed concurrently as noticed by KCSAN, + + LTP: starting fsync04 + /dev/zero: Can't open blockdev + EXT4-fs (loop0): mounting ext3 file system using the ext4 subsystem + EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null) + ================================================================== + BUG: KCSAN: data-race in __jbd2_journal_refile_buffer [jbd2] / jbd2_write_access_granted [jbd2] + + write to 0xffff99f9b1bd0e30 of 8 bytes by task 25721 on cpu 70: + __jbd2_journal_refile_buffer+0xdd/0x210 [jbd2] + __jbd2_journal_refile_buffer at fs/jbd2/transaction.c:2569 + jbd2_journal_commit_transaction+0x2d15/0x3f20 [jbd2] + (inlined by) jbd2_journal_commit_transaction at fs/jbd2/commit.c:1034 + kjournald2+0x13b/0x450 [jbd2] + kthread+0x1cd/0x1f0 + ret_from_fork+0x27/0x50 + + read to 0xffff99f9b1bd0e30 of 8 bytes by task 25724 on cpu 68: + jbd2_write_access_granted+0x1b2/0x250 [jbd2] + jbd2_write_access_granted at fs/jbd2/transaction.c:1155 + jbd2_journal_get_write_access+0x2c/0x60 [jbd2] + __ext4_journal_get_write_access+0x50/0x90 [ext4] + ext4_mb_mark_diskspace_used+0x158/0x620 [ext4] + ext4_mb_new_blocks+0x54f/0xca0 [ext4] + ext4_ind_map_blocks+0xc79/0x1b40 [ext4] + ext4_map_blocks+0x3b4/0x950 [ext4] + _ext4_get_block+0xfc/0x270 [ext4] + ext4_get_block+0x3b/0x50 [ext4] + __block_write_begin_int+0x22e/0xae0 + __block_write_begin+0x39/0x50 + ext4_write_begin+0x388/0xb50 [ext4] + generic_perform_write+0x15d/0x290 + ext4_buffered_write_iter+0x11f/0x210 [ext4] + ext4_file_write_iter+0xce/0x9e0 [ext4] + new_sync_write+0x29c/0x3b0 + __vfs_write+0x92/0xa0 + vfs_write+0x103/0x260 + ksys_write+0x9d/0x130 + __x64_sys_write+0x4c/0x60 + do_syscall_64+0x91/0xb05 + entry_SYSCALL_64_after_hwframe+0x49/0xbe + + 5 locks held by fsync04/25724: + #0: ffff99f9911093f8 (sb_writers#13){.+.+}, at: vfs_write+0x21c/0x260 + #1: ffff99f9db4c0348 (&sb->s_type->i_mutex_key#15){+.+.}, at: ext4_buffered_write_iter+0x65/0x210 [ext4] + #2: ffff99f5e7dfcf58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2] + #3: ffff99f9db4c0168 (&ei->i_data_sem){++++}, at: ext4_map_blocks+0x176/0x950 [ext4] + #4: ffffffff99086b40 (rcu_read_lock){....}, at: jbd2_write_access_granted+0x4e/0x250 [jbd2] + irq event stamp: 1407125 + hardirqs last enabled at (1407125): [] __find_get_block+0x107/0x790 + hardirqs last disabled at (1407124): [] __find_get_block+0x49/0x790 + softirqs last enabled at (1405528): [] __do_softirq+0x34c/0x57c + softirqs last disabled at (1405521): [] irq_exit+0xa2/0xc0 + + Reported by Kernel Concurrency Sanitizer on: + CPU: 68 PID: 25724 Comm: fsync04 Tainted: G L 5.6.0-rc2-next-20200221+ #7 + Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019 + +The plain reads are outside of jh->b_state_lock critical section which result +in data races. Fix them by adding pairs of READ|WRITE_ONCE(). + +Reviewed-by: Jan Kara +Signed-off-by: Qian Cai +Link: https://lore.kernel.org/r/20200222043111.2227-1-cai@lca.pw +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/jbd2/transaction.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c +index f2ff141a4479e..a355ca418e788 100644 +--- a/fs/jbd2/transaction.c ++++ b/fs/jbd2/transaction.c +@@ -1050,8 +1050,8 @@ static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh, + /* For undo access buffer must have data copied */ + if (undo && !jh->b_committed_data) + goto out; +- if (jh->b_transaction != handle->h_transaction && +- jh->b_next_transaction != handle->h_transaction) ++ if (READ_ONCE(jh->b_transaction) != handle->h_transaction && ++ READ_ONCE(jh->b_next_transaction) != handle->h_transaction) + goto out; + /* + * There are two reasons for the barrier here: +@@ -2466,8 +2466,8 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh) + * our jh reference and thus __jbd2_journal_file_buffer() must not + * take a new one. + */ +- jh->b_transaction = jh->b_next_transaction; +- jh->b_next_transaction = NULL; ++ WRITE_ONCE(jh->b_transaction, jh->b_next_transaction); ++ WRITE_ONCE(jh->b_next_transaction, NULL); + if (buffer_freed(bh)) + jlist = BJ_Forget; + else if (jh->b_modified) +-- +2.20.1 + diff --git a/queue-4.14/mac80211-rx-avoid-rcu-list-traversal-under-mutex.patch b/queue-4.14/mac80211-rx-avoid-rcu-list-traversal-under-mutex.patch new file mode 100644 index 00000000000..b0e626fb46a --- /dev/null +++ b/queue-4.14/mac80211-rx-avoid-rcu-list-traversal-under-mutex.patch @@ -0,0 +1,39 @@ +From 1774b8a09211d81310d139b6f3abb2a2ce44d7d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Feb 2020 20:03:02 +0530 +Subject: mac80211: rx: avoid RCU list traversal under mutex + +From: Madhuparna Bhowmik + +[ Upstream commit 253216ffb2a002a682c6f68bd3adff5b98b71de8 ] + +local->sta_mtx is held in __ieee80211_check_fast_rx_iface(). +No need to use list_for_each_entry_rcu() as it also requires +a cond argument to avoid false lockdep warnings when not used in +RCU read-side section (with CONFIG_PROVE_RCU_LIST). +Therefore use list_for_each_entry(); + +Signed-off-by: Madhuparna Bhowmik +Link: https://lore.kernel.org/r/20200223143302.15390-1-madhuparnabhowmik10@gmail.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/rx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 31000622376df..7c92b1471c34c 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3862,7 +3862,7 @@ void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata) + + lockdep_assert_held(&local->sta_mtx); + +- list_for_each_entry_rcu(sta, &local->sta_list, list) { ++ list_for_each_entry(sta, &local->sta_list, list) { + if (sdata != sta->sdata && + (!sta->sdata->bss || sta->sdata->bss != sdata->bss)) + continue; +-- +2.20.1 + diff --git a/queue-4.14/net-ks8851-ml-fix-irq-handling-and-locking.patch b/queue-4.14/net-ks8851-ml-fix-irq-handling-and-locking.patch new file mode 100644 index 00000000000..e4290936c34 --- /dev/null +++ b/queue-4.14/net-ks8851-ml-fix-irq-handling-and-locking.patch @@ -0,0 +1,102 @@ +From 560a966fe06f873d0c67be668b5fd3630d3f2253 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 23 Feb 2020 14:38:40 +0100 +Subject: net: ks8851-ml: Fix IRQ handling and locking + +From: Marek Vasut + +[ Upstream commit 44343418d0f2f623cb9da6f5000df793131cbe3b ] + +The KS8851 requires that packet RX and TX are mutually exclusive. +Currently, the driver hopes to achieve this by disabling interrupt +from the card by writing the card registers and by disabling the +interrupt on the interrupt controller. This however is racy on SMP. + +Replace this approach by expanding the spinlock used around the +ks_start_xmit() TX path to ks_irq() RX path to assure true mutual +exclusion and remove the interrupt enabling/disabling, which is +now not needed anymore. Furthermore, disable interrupts also in +ks_net_stop(), which was missing before. + +Note that a massive improvement here would be to re-use the KS8851 +driver approach, which is to move the TX path into a worker thread, +interrupt handling to threaded interrupt, and synchronize everything +with mutexes, but that would be a much bigger rework, for a separate +patch. + +Signed-off-by: Marek Vasut +Cc: David S. Miller +Cc: Lukas Wunner +Cc: Petr Stetiar +Cc: YueHaibing +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/micrel/ks8851_mll.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c +index 799154d7c0470..c699a779757eb 100644 +--- a/drivers/net/ethernet/micrel/ks8851_mll.c ++++ b/drivers/net/ethernet/micrel/ks8851_mll.c +@@ -831,14 +831,17 @@ static irqreturn_t ks_irq(int irq, void *pw) + { + struct net_device *netdev = pw; + struct ks_net *ks = netdev_priv(netdev); ++ unsigned long flags; + u16 status; + ++ spin_lock_irqsave(&ks->statelock, flags); + /*this should be the first in IRQ handler */ + ks_save_cmd_reg(ks); + + status = ks_rdreg16(ks, KS_ISR); + if (unlikely(!status)) { + ks_restore_cmd_reg(ks); ++ spin_unlock_irqrestore(&ks->statelock, flags); + return IRQ_NONE; + } + +@@ -864,6 +867,7 @@ static irqreturn_t ks_irq(int irq, void *pw) + ks->netdev->stats.rx_over_errors++; + /* this should be the last in IRQ handler*/ + ks_restore_cmd_reg(ks); ++ spin_unlock_irqrestore(&ks->statelock, flags); + return IRQ_HANDLED; + } + +@@ -933,6 +937,7 @@ static int ks_net_stop(struct net_device *netdev) + + /* shutdown RX/TX QMU */ + ks_disable_qmu(ks); ++ ks_disable_int(ks); + + /* set powermode to soft power down to save power */ + ks_set_powermode(ks, PMECR_PM_SOFTDOWN); +@@ -989,10 +994,9 @@ static netdev_tx_t ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) + { + netdev_tx_t retv = NETDEV_TX_OK; + struct ks_net *ks = netdev_priv(netdev); ++ unsigned long flags; + +- disable_irq(netdev->irq); +- ks_disable_int(ks); +- spin_lock(&ks->statelock); ++ spin_lock_irqsave(&ks->statelock, flags); + + /* Extra space are required: + * 4 byte for alignment, 4 for status/length, 4 for CRC +@@ -1006,9 +1010,7 @@ static netdev_tx_t ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) + dev_kfree_skb(skb); + } else + retv = NETDEV_TX_BUSY; +- spin_unlock(&ks->statelock); +- ks_enable_int(ks); +- enable_irq(netdev->irq); ++ spin_unlock_irqrestore(&ks->statelock, flags); + return retv; + } + +-- +2.20.1 + diff --git a/queue-4.14/net-rmnet-fix-null-pointer-dereference-in-rmnet_newl.patch b/queue-4.14/net-rmnet-fix-null-pointer-dereference-in-rmnet_newl.patch new file mode 100644 index 00000000000..9c1c15bb5ce --- /dev/null +++ b/queue-4.14/net-rmnet-fix-null-pointer-dereference-in-rmnet_newl.patch @@ -0,0 +1,82 @@ +From 250e753b0a9671627f56fcd10b278e81a6eaafa9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Feb 2020 12:23:52 +0000 +Subject: net: rmnet: fix NULL pointer dereference in rmnet_newlink() + +From: Taehee Yoo + +[ Upstream commit 93b5cbfa9636d385126f211dca9efa7e3f683202 ] + +rmnet registers IFLA_LINK interface as a lower interface. +But, IFLA_LINK could be NULL. +In the current code, rmnet doesn't check IFLA_LINK. +So, panic would occur. + +Test commands: + modprobe rmnet + ip link add rmnet0 type rmnet mux_id 1 + +Splat looks like: +[ 36.826109][ T1115] general protection fault, probably for non-canonical address 0xdffffc0000000000I +[ 36.838817][ T1115] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] +[ 36.839908][ T1115] CPU: 1 PID: 1115 Comm: ip Not tainted 5.6.0-rc1+ #447 +[ 36.840569][ T1115] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 +[ 36.841408][ T1115] RIP: 0010:rmnet_newlink+0x54/0x510 [rmnet] +[ 36.841986][ T1115] Code: 83 ec 18 48 c1 e9 03 80 3c 01 00 0f 85 d4 03 00 00 48 8b 6a 28 48 b8 00 00 00 00 00 c +[ 36.843923][ T1115] RSP: 0018:ffff8880b7e0f1c0 EFLAGS: 00010247 +[ 36.844756][ T1115] RAX: dffffc0000000000 RBX: ffff8880d14cca00 RCX: 1ffff11016fc1e99 +[ 36.845859][ T1115] RDX: 0000000000000000 RSI: ffff8880c3d04000 RDI: 0000000000000004 +[ 36.846961][ T1115] RBP: 0000000000000000 R08: ffff8880b7e0f8b0 R09: ffff8880b6ac2d90 +[ 36.848020][ T1115] R10: ffffffffc0589a40 R11: ffffed1016d585b7 R12: ffffffff88ceaf80 +[ 36.848788][ T1115] R13: ffff8880c3d04000 R14: ffff8880b7e0f8b0 R15: ffff8880c3d04000 +[ 36.849546][ T1115] FS: 00007f50ab3360c0(0000) GS:ffff8880da000000(0000) knlGS:0000000000000000 +[ 36.851784][ T1115] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 36.852422][ T1115] CR2: 000055871afe5ab0 CR3: 00000000ae246001 CR4: 00000000000606e0 +[ 36.853181][ T1115] Call Trace: +[ 36.853514][ T1115] __rtnl_newlink+0xbdb/0x1270 +[ 36.853967][ T1115] ? lock_downgrade+0x6e0/0x6e0 +[ 36.854420][ T1115] ? rtnl_link_unregister+0x220/0x220 +[ 36.854936][ T1115] ? lock_acquire+0x164/0x3b0 +[ 36.855376][ T1115] ? is_bpf_image_address+0xff/0x1d0 +[ 36.855884][ T1115] ? rtnl_newlink+0x4c/0x90 +[ 36.856304][ T1115] ? kernel_text_address+0x111/0x140 +[ 36.856857][ T1115] ? __kernel_text_address+0xe/0x30 +[ 36.857440][ T1115] ? unwind_get_return_address+0x5f/0xa0 +[ 36.858063][ T1115] ? create_prof_cpu_mask+0x20/0x20 +[ 36.858644][ T1115] ? arch_stack_walk+0x83/0xb0 +[ 36.859171][ T1115] ? stack_trace_save+0x82/0xb0 +[ 36.859710][ T1115] ? stack_trace_consume_entry+0x160/0x160 +[ 36.860357][ T1115] ? deactivate_slab.isra.78+0x2c5/0x800 +[ 36.860928][ T1115] ? kasan_unpoison_shadow+0x30/0x40 +[ 36.861520][ T1115] ? kmem_cache_alloc_trace+0x135/0x350 +[ 36.862125][ T1115] ? rtnl_newlink+0x4c/0x90 +[ 36.864073][ T1115] rtnl_newlink+0x65/0x90 +[ ... ] + +Fixes: ceed73a2cf4a ("drivers: net: ethernet: qualcomm: rmnet: Initial implementation") +Signed-off-by: Taehee Yoo +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +index 7d8303e45f090..b7df8c1121e35 100644 +--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c ++++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +@@ -157,6 +157,11 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev, + int err = 0; + u16 mux_id; + ++ if (!tb[IFLA_LINK]) { ++ NL_SET_ERR_MSG_MOD(extack, "link not specified"); ++ return -EINVAL; ++ } ++ + real_dev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK])); + if (!real_dev || !dev) + return -ENODEV; +-- +2.20.1 + diff --git a/queue-4.14/net-usb-qmi_wwan-restore-mtu-min-max-values-after-ra.patch b/queue-4.14/net-usb-qmi_wwan-restore-mtu-min-max-values-after-ra.patch new file mode 100644 index 00000000000..854a055593a --- /dev/null +++ b/queue-4.14/net-usb-qmi_wwan-restore-mtu-min-max-values-after-ra.patch @@ -0,0 +1,51 @@ +From 8facf607a5a9e260981876b5029c2a4f533f2c32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Feb 2020 14:17:05 +0100 +Subject: net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Daniele Palmas + +[ Upstream commit eae7172f8141eb98e64e6e81acc9e9d5b2add127 ] + +usbnet creates network interfaces with min_mtu = 0 and +max_mtu = ETH_MAX_MTU. + +These values are not modified by qmi_wwan when the network interface +is created initially, allowing, for example, to set mtu greater than 1500. + +When a raw_ip switch is done (raw_ip set to 'Y', then set to 'N') the mtu +values for the network interface are set through ether_setup, with +min_mtu = ETH_MIN_MTU and max_mtu = ETH_DATA_LEN, not allowing anymore to +set mtu greater than 1500 (error: mtu greater than device maximum). + +The patch restores the original min/max mtu values set by usbnet after a +raw_ip switch. + +Signed-off-by: Daniele Palmas +Acked-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 189715438328f..a8d5561afc7d4 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -274,6 +274,9 @@ static void qmi_wwan_netdev_setup(struct net_device *net) + netdev_dbg(net, "mode: raw IP\n"); + } else if (!net->header_ops) { /* don't bother if already set */ + ether_setup(net); ++ /* Restoring min/max mtu values set originally by usbnet */ ++ net->min_mtu = 0; ++ net->max_mtu = ETH_MAX_MTU; + clear_bit(EVENT_NO_IP_ALIGN, &dev->flags); + netdev_dbg(net, "mode: Ethernet\n"); + } +-- +2.20.1 + diff --git a/queue-4.14/scsi-libfc-free-response-frame-from-gpn_id.patch b/queue-4.14/scsi-libfc-free-response-frame-from-gpn_id.patch new file mode 100644 index 00000000000..7796d441113 --- /dev/null +++ b/queue-4.14/scsi-libfc-free-response-frame-from-gpn_id.patch @@ -0,0 +1,37 @@ +From f5aafef20ebe3354f4d7474507275c4f96f199ef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2020 14:43:19 +0000 +Subject: scsi: libfc: free response frame from GPN_ID + +From: Igor Druzhinin + +[ Upstream commit ff6993bb79b9f99bdac0b5378169052931b65432 ] + +fc_disc_gpn_id_resp() should be the last function using it so free it here +to avoid memory leak. + +Link: https://lore.kernel.org/r/1579013000-14570-2-git-send-email-igor.druzhinin@citrix.com +Reviewed-by: Hannes Reinecke +Signed-off-by: Igor Druzhinin +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/libfc/fc_disc.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c +index bb9c1c0166439..28b50ab2fbb01 100644 +--- a/drivers/scsi/libfc/fc_disc.c ++++ b/drivers/scsi/libfc/fc_disc.c +@@ -652,6 +652,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, + } + out: + kref_put(&rdata->kref, fc_rport_destroy); ++ if (!IS_ERR(fp)) ++ fc_frame_free(fp); + } + + /** +-- +2.20.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 49b9472d038..928a5ccd909 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -80,3 +80,16 @@ batman-adv-avoid-free-alloc-race-when-handling-ogm2-buffer.patch batman-adv-avoid-free-alloc-race-when-handling-ogm-buffer.patch batman-adv-don-t-schedule-ogm-for-disabled-interface.patch perf-amd-uncore-replace-manual-sampling-check-with-c.patch +acpi-watchdog-allow-disabling-wdat-at-boot.patch +hid-apple-add-support-for-recent-firmware-on-magic-k.patch +hid-i2c-hid-add-trekstor-surfbook-e11b-to-descriptor.patch +cfg80211-check-reg_rule-for-null-in-handle_channel_c.patch +scsi-libfc-free-response-frame-from-gpn_id.patch +net-usb-qmi_wwan-restore-mtu-min-max-values-after-ra.patch +net-ks8851-ml-fix-irq-handling-and-locking.patch +mac80211-rx-avoid-rcu-list-traversal-under-mutex.patch +signal-avoid-double-atomic-counter-increments-for-us.patch +slip-not-call-free_netdev-before-rtnl_unlock-in-slip.patch +hinic-fix-a-bug-of-setting-hw_ioctxt.patch +net-rmnet-fix-null-pointer-dereference-in-rmnet_newl.patch +jbd2-fix-data-races-at-struct-journal_head.patch diff --git a/queue-4.14/signal-avoid-double-atomic-counter-increments-for-us.patch b/queue-4.14/signal-avoid-double-atomic-counter-increments-for-us.patch new file mode 100644 index 00000000000..65dd87edd17 --- /dev/null +++ b/queue-4.14/signal-avoid-double-atomic-counter-increments-for-us.patch @@ -0,0 +1,125 @@ +From 6514d590bf4acf9f8568abddf80b97473964d1a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Feb 2020 12:47:14 -0800 +Subject: signal: avoid double atomic counter increments for user accounting + +From: Linus Torvalds + +[ Upstream commit fda31c50292a5062332fa0343c084bd9f46604d9 ] + +When queueing a signal, we increment both the users count of pending +signals (for RLIMIT_SIGPENDING tracking) and we increment the refcount +of the user struct itself (because we keep a reference to the user in +the signal structure in order to correctly account for it when freeing). + +That turns out to be fairly expensive, because both of them are atomic +updates, and particularly under extreme signal handling pressure on big +machines, you can get a lot of cache contention on the user struct. +That can then cause horrid cacheline ping-pong when you do these +multiple accesses. + +So change the reference counting to only pin the user for the _first_ +pending signal, and to unpin it when the last pending signal is +dequeued. That means that when a user sees a lot of concurrent signal +queuing - which is the only situation when this matters - the only +atomic access needed is generally the 'sigpending' count update. + +This was noticed because of a particularly odd timing artifact on a +dual-socket 96C/192T Cascade Lake platform: when you get into bad +contention, on that machine for some reason seems to be much worse when +the contention happens in the upper 32-byte half of the cacheline. + +As a result, the kernel test robot will-it-scale 'signal1' benchmark had +an odd performance regression simply due to random alignment of the +'struct user_struct' (and pointed to a completely unrelated and +apparently nonsensical commit for the regression). + +Avoiding the double increments (and decrements on the dequeueing side, +of course) makes for much less contention and hugely improved +performance on that will-it-scale microbenchmark. + +Quoting Feng Tang: + + "It makes a big difference, that the performance score is tripled! bump + from original 17000 to 54000. Also the gap between 5.0-rc6 and + 5.0-rc6+Jiri's patch is reduced to around 2%" + +[ The "2% gap" is the odd cacheline placement difference on that + platform: under the extreme contention case, the effect of which half + of the cacheline was hot was 5%, so with the reduced contention the + odd timing artifact is reduced too ] + +It does help in the non-contended case too, but is not nearly as +noticeable. + +Reported-and-tested-by: Feng Tang +Cc: Eric W. Biederman +Cc: Huang, Ying +Cc: Philip Li +Cc: Andi Kleen +Cc: Jiri Olsa +Cc: Peter Zijlstra +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/signal.c | 23 ++++++++++++++--------- + 1 file changed, 14 insertions(+), 9 deletions(-) + +diff --git a/kernel/signal.c b/kernel/signal.c +index 8fee1f2eba2f9..c066168f88541 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -379,27 +379,32 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi + { + struct sigqueue *q = NULL; + struct user_struct *user; ++ int sigpending; + + /* + * Protect access to @t credentials. This can go away when all + * callers hold rcu read lock. ++ * ++ * NOTE! A pending signal will hold on to the user refcount, ++ * and we get/put the refcount only when the sigpending count ++ * changes from/to zero. + */ + rcu_read_lock(); +- user = get_uid(__task_cred(t)->user); +- atomic_inc(&user->sigpending); ++ user = __task_cred(t)->user; ++ sigpending = atomic_inc_return(&user->sigpending); ++ if (sigpending == 1) ++ get_uid(user); + rcu_read_unlock(); + +- if (override_rlimit || +- atomic_read(&user->sigpending) <= +- task_rlimit(t, RLIMIT_SIGPENDING)) { ++ if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) { + q = kmem_cache_alloc(sigqueue_cachep, flags); + } else { + print_dropped_signal(sig); + } + + if (unlikely(q == NULL)) { +- atomic_dec(&user->sigpending); +- free_uid(user); ++ if (atomic_dec_and_test(&user->sigpending)) ++ free_uid(user); + } else { + INIT_LIST_HEAD(&q->list); + q->flags = 0; +@@ -413,8 +418,8 @@ static void __sigqueue_free(struct sigqueue *q) + { + if (q->flags & SIGQUEUE_PREALLOC) + return; +- atomic_dec(&q->user->sigpending); +- free_uid(q->user); ++ if (atomic_dec_and_test(&q->user->sigpending)) ++ free_uid(q->user); + kmem_cache_free(sigqueue_cachep, q); + } + +-- +2.20.1 + diff --git a/queue-4.14/slip-not-call-free_netdev-before-rtnl_unlock-in-slip.patch b/queue-4.14/slip-not-call-free_netdev-before-rtnl_unlock-in-slip.patch new file mode 100644 index 00000000000..3f5da09206d --- /dev/null +++ b/queue-4.14/slip-not-call-free_netdev-before-rtnl_unlock-in-slip.patch @@ -0,0 +1,38 @@ +From 97b70233fb370d9b0b16b01b87023eb89a59655e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Feb 2020 11:54:35 +0800 +Subject: slip: not call free_netdev before rtnl_unlock in slip_open + +From: yangerkun + +[ Upstream commit f596c87005f7b1baeb7d62d9a9e25d68c3dfae10 ] + +As the description before netdev_run_todo, we cannot call free_netdev +before rtnl_unlock, fix it by reorder the code. + +Signed-off-by: yangerkun +Reviewed-by: Oliver Hartkopp +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/slip/slip.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c +index b07f367abd915..d7882b548b79a 100644 +--- a/drivers/net/slip/slip.c ++++ b/drivers/net/slip/slip.c +@@ -867,7 +867,10 @@ static int slip_open(struct tty_struct *tty) + tty->disc_data = NULL; + clear_bit(SLF_INUSE, &sl->flags); + sl_free_netdev(sl->dev); ++ /* do not call free_netdev before rtnl_unlock */ ++ rtnl_unlock(); + free_netdev(sl->dev); ++ return err; + + err_exit: + rtnl_unlock(); +-- +2.20.1 +