From: Greg Kroah-Hartman Date: Mon, 14 Jan 2019 09:58:21 +0000 (+0100) Subject: 4.20-stable patches X-Git-Tag: v4.20.3~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21882a5105980f9ceb9a509f2fe3d5993779a3ae;p=thirdparty%2Fkernel%2Fstable-queue.git 4.20-stable patches added patches: btrfs-fix-deadlock-when-using-free-space-tree-due-to-block-group-creation.patch cpufreq-scmi-fix-frequency-invariance-in-slow-path.patch cpufreq-scpi-scmi-fix-freeing-of-dynamic-opps.patch staging-rtl8188eu-fix-module-loading-from-tasklet-for-ccmp-encryption.patch staging-rtl8188eu-fix-module-loading-from-tasklet-for-wep-encryption.patch usbcore-select-only-first-configuration-for-non-uac3-compliant-devices.patch x86-modpost-replace-last-remnants-of-retpoline-with-config_retpoline.patch --- diff --git a/queue-4.20/btrfs-fix-deadlock-when-using-free-space-tree-due-to-block-group-creation.patch b/queue-4.20/btrfs-fix-deadlock-when-using-free-space-tree-due-to-block-group-creation.patch new file mode 100644 index 00000000000..88c9f736f39 --- /dev/null +++ b/queue-4.20/btrfs-fix-deadlock-when-using-free-space-tree-due-to-block-group-creation.patch @@ -0,0 +1,64 @@ +From a6d8654d885d7d79a3fb82da64eaa489ca332a82 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Tue, 8 Jan 2019 11:44:41 +0000 +Subject: Btrfs: fix deadlock when using free space tree due to block group creation + +From: Filipe Manana + +commit a6d8654d885d7d79a3fb82da64eaa489ca332a82 upstream. + +When modifying the free space tree we can end up COWing one of its extent +buffers which in turn might result in allocating a new chunk, which in +turn can result in flushing (finish creation) of pending block groups. If +that happens we can deadlock because creating a pending block group needs +to update the free space tree, and if any of the updates tries to modify +the same extent buffer that we are COWing, we end up in a deadlock since +we try to write lock twice the same extent buffer. + +So fix this by skipping pending block group creation if we are COWing an +extent buffer from the free space tree. This is a case missed by commit +5ce555578e091 ("Btrfs: fix deadlock when writing out free space caches"). + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202173 +Fixes: 5ce555578e091 ("Btrfs: fix deadlock when writing out free space caches") +CC: stable@vger.kernel.org # 4.18+ +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/ctree.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/fs/btrfs/ctree.c ++++ b/fs/btrfs/ctree.c +@@ -1015,19 +1015,21 @@ static noinline int __btrfs_cow_block(st + parent_start = parent->start; + + /* +- * If we are COWing a node/leaf from the extent, chunk or device trees, +- * make sure that we do not finish block group creation of pending block +- * groups. We do this to avoid a deadlock. ++ * If we are COWing a node/leaf from the extent, chunk, device or free ++ * space trees, make sure that we do not finish block group creation of ++ * pending block groups. We do this to avoid a deadlock. + * COWing can result in allocation of a new chunk, and flushing pending + * block groups (btrfs_create_pending_block_groups()) can be triggered + * when finishing allocation of a new chunk. Creation of a pending block +- * group modifies the extent, chunk and device trees, therefore we could +- * deadlock with ourselves since we are holding a lock on an extent +- * buffer that btrfs_create_pending_block_groups() may try to COW later. ++ * group modifies the extent, chunk, device and free space trees, ++ * therefore we could deadlock with ourselves since we are holding a ++ * lock on an extent buffer that btrfs_create_pending_block_groups() may ++ * try to COW later. + */ + if (root == fs_info->extent_root || + root == fs_info->chunk_root || +- root == fs_info->dev_root) ++ root == fs_info->dev_root || ++ root == fs_info->free_space_root) + trans->can_flush_pending_bgs = false; + + cow = btrfs_alloc_tree_block(trans, root, parent_start, diff --git a/queue-4.20/cpufreq-scmi-fix-frequency-invariance-in-slow-path.patch b/queue-4.20/cpufreq-scmi-fix-frequency-invariance-in-slow-path.patch new file mode 100644 index 00000000000..24a2c6936c1 --- /dev/null +++ b/queue-4.20/cpufreq-scmi-fix-frequency-invariance-in-slow-path.patch @@ -0,0 +1,44 @@ +From 0e141d1c65c1dd31c914eb2e11651adcc1a15912 Mon Sep 17 00:00:00 2001 +From: Quentin Perret +Date: Wed, 9 Jan 2019 10:42:36 +0000 +Subject: cpufreq: scmi: Fix frequency invariance in slow path + +From: Quentin Perret + +commit 0e141d1c65c1dd31c914eb2e11651adcc1a15912 upstream. + +The scmi-cpufreq driver calls the arch_set_freq_scale() callback on +frequency changes to provide scale-invariant load-tracking signals to +the scheduler. However, in the slow path, it does so while specifying +the current and max frequencies in different units, hence resulting in a +broken freq_scale factor. + +Fix this by passing all frequencies in KHz, as stored in the CPUFreq +frequency table. + +Fixes: 99d6bdf33877 (cpufreq: add support for CPU DVFS based on SCMI message protocol) +Signed-off-by: Quentin Perret +Acked-by: Viresh Kumar +Acked-by: Sudeep Holla +Cc: 4.17+ # v4.17+ +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/scmi-cpufreq.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/cpufreq/scmi-cpufreq.c ++++ b/drivers/cpufreq/scmi-cpufreq.c +@@ -52,9 +52,9 @@ scmi_cpufreq_set_target(struct cpufreq_p + int ret; + struct scmi_data *priv = policy->driver_data; + struct scmi_perf_ops *perf_ops = handle->perf_ops; +- u64 freq = policy->freq_table[index].frequency * 1000; ++ u64 freq = policy->freq_table[index].frequency; + +- ret = perf_ops->freq_set(handle, priv->domain_id, freq, false); ++ ret = perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false); + if (!ret) + arch_set_freq_scale(policy->related_cpus, freq, + policy->cpuinfo.max_freq); diff --git a/queue-4.20/cpufreq-scpi-scmi-fix-freeing-of-dynamic-opps.patch b/queue-4.20/cpufreq-scpi-scmi-fix-freeing-of-dynamic-opps.patch new file mode 100644 index 00000000000..7c98ea240f9 --- /dev/null +++ b/queue-4.20/cpufreq-scpi-scmi-fix-freeing-of-dynamic-opps.patch @@ -0,0 +1,201 @@ +From 1690d8bb91e370ab772062b79bd434ce815c4729 Mon Sep 17 00:00:00 2001 +From: Viresh Kumar +Date: Fri, 4 Jan 2019 15:14:33 +0530 +Subject: cpufreq: scpi/scmi: Fix freeing of dynamic OPPs + +From: Viresh Kumar + +commit 1690d8bb91e370ab772062b79bd434ce815c4729 upstream. + +Since the commit 2a4eb7358aba "OPP: Don't remove dynamic OPPs from +_dev_pm_opp_remove_table()", dynamically created OPP aren't +automatically removed anymore by dev_pm_opp_cpumask_remove_table(). This +affects the scpi and scmi cpufreq drivers which no longer free OPPs on +failures or on invocations of the policy->exit() callback. + +Create a generic OPP helper dev_pm_opp_remove_all_dynamic() which can be +called from these drivers instead of dev_pm_opp_cpumask_remove_table(). + +In dev_pm_opp_remove_all_dynamic(), we need to make sure that the +opp_list isn't getting accessed simultaneously from other parts of the +OPP core while the helper is freeing dynamic OPPs, i.e. we can't drop +the opp_table->lock while traversing through the OPP list. And to +accomplish that, this patch also creates _opp_kref_release_unlocked() +which can be called from this new helper with the opp_table lock already +held. + +Cc: 4.20 # v4.20 +Reported-by: Valentin Schneider +Fixes: 2a4eb7358aba "OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table()" +Signed-off-by: Viresh Kumar +Tested-by: Valentin Schneider +Reviewed-by: Sudeep Holla +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/scmi-cpufreq.c | 4 +- + drivers/cpufreq/scpi-cpufreq.c | 4 +- + drivers/opp/core.c | 63 +++++++++++++++++++++++++++++++++++++---- + include/linux/pm_opp.h | 5 +++ + 4 files changed, 67 insertions(+), 9 deletions(-) + +--- a/drivers/cpufreq/scmi-cpufreq.c ++++ b/drivers/cpufreq/scmi-cpufreq.c +@@ -176,7 +176,7 @@ static int scmi_cpufreq_init(struct cpuf + out_free_priv: + kfree(priv); + out_free_opp: +- dev_pm_opp_cpumask_remove_table(policy->cpus); ++ dev_pm_opp_remove_all_dynamic(cpu_dev); + + return ret; + } +@@ -188,7 +188,7 @@ static int scmi_cpufreq_exit(struct cpuf + cpufreq_cooling_unregister(priv->cdev); + dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); + kfree(priv); +- dev_pm_opp_cpumask_remove_table(policy->related_cpus); ++ dev_pm_opp_remove_all_dynamic(priv->cpu_dev); + + return 0; + } +--- a/drivers/cpufreq/scpi-cpufreq.c ++++ b/drivers/cpufreq/scpi-cpufreq.c +@@ -177,7 +177,7 @@ out_free_cpufreq_table: + out_free_priv: + kfree(priv); + out_free_opp: +- dev_pm_opp_cpumask_remove_table(policy->cpus); ++ dev_pm_opp_remove_all_dynamic(cpu_dev); + + return ret; + } +@@ -190,7 +190,7 @@ static int scpi_cpufreq_exit(struct cpuf + clk_put(priv->clk); + dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); + kfree(priv); +- dev_pm_opp_cpumask_remove_table(policy->related_cpus); ++ dev_pm_opp_remove_all_dynamic(priv->cpu_dev); + + return 0; + } +--- a/drivers/opp/core.c ++++ b/drivers/opp/core.c +@@ -951,11 +951,9 @@ void _opp_free(struct dev_pm_opp *opp) + kfree(opp); + } + +-static void _opp_kref_release(struct kref *kref) ++static void _opp_kref_release(struct dev_pm_opp *opp, ++ struct opp_table *opp_table) + { +- struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); +- struct opp_table *opp_table = opp->opp_table; +- + /* + * Notify the changes in the availability of the operable + * frequency/voltage list. +@@ -964,7 +962,22 @@ static void _opp_kref_release(struct kre + opp_debug_remove_one(opp); + list_del(&opp->node); + kfree(opp); ++} ++ ++static void _opp_kref_release_unlocked(struct kref *kref) ++{ ++ struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); ++ struct opp_table *opp_table = opp->opp_table; ++ ++ _opp_kref_release(opp, opp_table); ++} + ++static void _opp_kref_release_locked(struct kref *kref) ++{ ++ struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref); ++ struct opp_table *opp_table = opp->opp_table; ++ ++ _opp_kref_release(opp, opp_table); + mutex_unlock(&opp_table->lock); + } + +@@ -975,10 +988,16 @@ void dev_pm_opp_get(struct dev_pm_opp *o + + void dev_pm_opp_put(struct dev_pm_opp *opp) + { +- kref_put_mutex(&opp->kref, _opp_kref_release, &opp->opp_table->lock); ++ kref_put_mutex(&opp->kref, _opp_kref_release_locked, ++ &opp->opp_table->lock); + } + EXPORT_SYMBOL_GPL(dev_pm_opp_put); + ++static void dev_pm_opp_put_unlocked(struct dev_pm_opp *opp) ++{ ++ kref_put(&opp->kref, _opp_kref_release_unlocked); ++} ++ + /** + * dev_pm_opp_remove() - Remove an OPP from OPP table + * @dev: device for which we do this operation +@@ -1022,6 +1041,40 @@ void dev_pm_opp_remove(struct device *de + } + EXPORT_SYMBOL_GPL(dev_pm_opp_remove); + ++/** ++ * dev_pm_opp_remove_all_dynamic() - Remove all dynamically created OPPs ++ * @dev: device for which we do this operation ++ * ++ * This function removes all dynamically created OPPs from the opp table. ++ */ ++void dev_pm_opp_remove_all_dynamic(struct device *dev) ++{ ++ struct opp_table *opp_table; ++ struct dev_pm_opp *opp, *temp; ++ int count = 0; ++ ++ opp_table = _find_opp_table(dev); ++ if (IS_ERR(opp_table)) ++ return; ++ ++ mutex_lock(&opp_table->lock); ++ list_for_each_entry_safe(opp, temp, &opp_table->opp_list, node) { ++ if (opp->dynamic) { ++ dev_pm_opp_put_unlocked(opp); ++ count++; ++ } ++ } ++ mutex_unlock(&opp_table->lock); ++ ++ /* Drop the references taken by dev_pm_opp_add() */ ++ while (count--) ++ dev_pm_opp_put_opp_table(opp_table); ++ ++ /* Drop the reference taken by _find_opp_table() */ ++ dev_pm_opp_put_opp_table(opp_table); ++} ++EXPORT_SYMBOL_GPL(dev_pm_opp_remove_all_dynamic); ++ + struct dev_pm_opp *_opp_allocate(struct opp_table *table) + { + struct dev_pm_opp *opp; +--- a/include/linux/pm_opp.h ++++ b/include/linux/pm_opp.h +@@ -108,6 +108,7 @@ void dev_pm_opp_put(struct dev_pm_opp *o + int dev_pm_opp_add(struct device *dev, unsigned long freq, + unsigned long u_volt); + void dev_pm_opp_remove(struct device *dev, unsigned long freq); ++void dev_pm_opp_remove_all_dynamic(struct device *dev); + + int dev_pm_opp_enable(struct device *dev, unsigned long freq); + +@@ -214,6 +215,10 @@ static inline void dev_pm_opp_remove(str + { + } + ++static inline void dev_pm_opp_remove_all_dynamic(struct device *dev) ++{ ++} ++ + static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) + { + return 0; diff --git a/queue-4.20/series b/queue-4.20/series index de1379c5f0a..93162ab92a3 100644 --- a/queue-4.20/series +++ b/queue-4.20/series @@ -1 +1,8 @@ powerpc-tm-unset-msr-if-not-recheckpointing.patch +btrfs-fix-deadlock-when-using-free-space-tree-due-to-block-group-creation.patch +usbcore-select-only-first-configuration-for-non-uac3-compliant-devices.patch +staging-rtl8188eu-fix-module-loading-from-tasklet-for-ccmp-encryption.patch +staging-rtl8188eu-fix-module-loading-from-tasklet-for-wep-encryption.patch +cpufreq-scpi-scmi-fix-freeing-of-dynamic-opps.patch +cpufreq-scmi-fix-frequency-invariance-in-slow-path.patch +x86-modpost-replace-last-remnants-of-retpoline-with-config_retpoline.patch diff --git a/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-ccmp-encryption.patch b/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-ccmp-encryption.patch new file mode 100644 index 00000000000..86bffdf9149 --- /dev/null +++ b/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-ccmp-encryption.patch @@ -0,0 +1,39 @@ +From 84cad97a717f5749a0236abd5ce68da582ea074f Mon Sep 17 00:00:00 2001 +From: Larry Finger +Date: Wed, 2 Jan 2019 20:12:46 -0600 +Subject: staging: rtl8188eu: Fix module loading from tasklet for CCMP encryption + +From: Larry Finger + +commit 84cad97a717f5749a0236abd5ce68da582ea074f upstream. + +Commit 6bd082af7e36 ("staging:r8188eu: use lib80211 CCMP decrypt") +causes scheduling while atomic bugs followed by a hard freeze whenever +the driver tries to connect to a CCMP-encrypted network. Experimentation +showed that the freezes were eliminated when module lib80211 was +preloaded, which can be forced by calling lib80211_get_crypto_ops() +directly rather than indirectly through try_then_request_module(). +With this change, no BUG messages are logged. + +Fixes: 6bd082af7e36 ("staging:r8188eu: use lib80211 CCMP decrypt") +Cc: Stable # v4.17+ +Reported-and-tested-by: Michael Straube +Cc: Ivan Safonov +Signed-off-by: Larry Finger +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/rtl8188eu/core/rtw_security.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/staging/rtl8188eu/core/rtw_security.c ++++ b/drivers/staging/rtl8188eu/core/rtw_security.c +@@ -1291,7 +1291,7 @@ u32 rtw_aes_decrypt(struct adapter *pada + struct sk_buff *skb = ((struct recv_frame *)precvframe)->pkt; + void *crypto_private = NULL; + u8 *key, *pframe = skb->data; +- struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("CCMP"), "lib80211_crypt_ccmp"); ++ struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("CCMP"); + struct security_priv *psecuritypriv = &padapter->securitypriv; + char iv[8], icv[8]; + diff --git a/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-wep-encryption.patch b/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-wep-encryption.patch new file mode 100644 index 00000000000..a8afaeeaa82 --- /dev/null +++ b/queue-4.20/staging-rtl8188eu-fix-module-loading-from-tasklet-for-wep-encryption.patch @@ -0,0 +1,48 @@ +From 7775665aadc48a562051834a73519129bf717d73 Mon Sep 17 00:00:00 2001 +From: Larry Finger +Date: Wed, 2 Jan 2019 20:12:47 -0600 +Subject: staging: rtl8188eu: Fix module loading from tasklet for WEP encryption + +From: Larry Finger + +commit 7775665aadc48a562051834a73519129bf717d73 upstream. + +Commit 2b2ea09e74a5 ("staging:r8188eu: Use lib80211 to decrypt WEP-frames") +causes scheduling while atomic bugs followed by a hard freeze whenever +the driver tries to connect to a WEP-encrypted network. Experimentation +showed that the freezes were eliminated when module lib80211 was +preloaded, which can be forced by calling lib80211_get_crypto_ops() +directly rather than indirectly through try_then_request_module(). +With this change, no BUG messages are logged. + +Fixes: 2b2ea09e74a5 ("staging:r8188eu: Use lib80211 to decrypt WEP-frames") +Cc: Stable # v4.17+ +Cc: Michael Straube +Cc: Ivan Safonov +Signed-off-by: Larry Finger +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/rtl8188eu/core/rtw_security.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/staging/rtl8188eu/core/rtw_security.c ++++ b/drivers/staging/rtl8188eu/core/rtw_security.c +@@ -154,7 +154,7 @@ void rtw_wep_encrypt(struct adapter *pad + + pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset; + +- crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep"); ++ crypto_ops = lib80211_get_crypto_ops("WEP"); + + if (!crypto_ops) + return; +@@ -210,7 +210,7 @@ int rtw_wep_decrypt(struct adapter *pad + void *crypto_private = NULL; + int status = _SUCCESS; + const int keyindex = prxattrib->key_index; +- struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep"); ++ struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("WEP"); + char iv[4], icv[4]; + + if (!crypto_ops) { diff --git a/queue-4.20/usbcore-select-only-first-configuration-for-non-uac3-compliant-devices.patch b/queue-4.20/usbcore-select-only-first-configuration-for-non-uac3-compliant-devices.patch new file mode 100644 index 00000000000..be194504e02 --- /dev/null +++ b/queue-4.20/usbcore-select-only-first-configuration-for-non-uac3-compliant-devices.patch @@ -0,0 +1,47 @@ +From ff2a8c532c14fd22fb26a36574d9ff199afbbe54 Mon Sep 17 00:00:00 2001 +From: Saranya Gopal +Date: Sun, 6 Jan 2019 08:14:02 +0530 +Subject: usbcore: Select only first configuration for non-UAC3 compliant devices + +From: Saranya Gopal + +commit ff2a8c532c14fd22fb26a36574d9ff199afbbe54 upstream. + +In most of the UAC1 and UAC2 audio devices, the first +configuration is most often the best configuration. +However, with recent patch to support UAC3 configuration, +second configuration was unintentionally chosen for +some of the UAC1/2 devices that had more than one +configuration. This was because of the existing check +after the audio config check which selected any config +which had a non-vendor class. This patch fixes this issue. + +Fixes: f13912d3f014 ("usbcore: Select UAC3 configuration for audio if present") +Reported-by: Con Kolivas +Signed-off-by: Saranya Gopal +Tested-by: Con Kolivas +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/generic.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/usb/core/generic.c ++++ b/drivers/usb/core/generic.c +@@ -143,9 +143,12 @@ int usb_choose_configuration(struct usb_ + continue; + } + +- if (i > 0 && desc && is_audio(desc) && is_uac3_config(desc)) { +- best = c; +- break; ++ if (i > 0 && desc && is_audio(desc)) { ++ if (is_uac3_config(desc)) { ++ best = c; ++ break; ++ } ++ continue; + } + + /* From the remaining configs, choose the first one whose diff --git a/queue-4.20/x86-modpost-replace-last-remnants-of-retpoline-with-config_retpoline.patch b/queue-4.20/x86-modpost-replace-last-remnants-of-retpoline-with-config_retpoline.patch new file mode 100644 index 00000000000..76a15f4c409 --- /dev/null +++ b/queue-4.20/x86-modpost-replace-last-remnants-of-retpoline-with-config_retpoline.patch @@ -0,0 +1,99 @@ +From e4f358916d528d479c3c12bd2fd03f2d5a576380 Mon Sep 17 00:00:00 2001 +From: WANG Chao +Date: Tue, 11 Dec 2018 00:37:25 +0800 +Subject: x86, modpost: Replace last remnants of RETPOLINE with CONFIG_RETPOLINE + +From: WANG Chao + +commit e4f358916d528d479c3c12bd2fd03f2d5a576380 upstream. + +Commit + + 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support") + +replaced the RETPOLINE define with CONFIG_RETPOLINE checks. Remove the +remaining pieces. + + [ bp: Massage commit message. ] + +Fixes: 4cd24de3a098 ("x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support") +Signed-off-by: WANG Chao +Signed-off-by: Borislav Petkov +Reviewed-by: Zhenzhong Duan +Reviewed-by: Masahiro Yamada +Cc: "H. Peter Anvin" +Cc: Andi Kleen +Cc: Andrew Morton +Cc: Andy Lutomirski +Cc: Arnd Bergmann +Cc: Daniel Borkmann +Cc: David Woodhouse +Cc: Geert Uytterhoeven +Cc: Jessica Yu +Cc: Jiri Kosina +Cc: Kees Cook +Cc: Konrad Rzeszutek Wilk +Cc: Luc Van Oostenryck +Cc: Michal Marek +Cc: Miguel Ojeda +Cc: Peter Zijlstra +Cc: Tim Chen +Cc: Vasily Gorbik +Cc: linux-kbuild@vger.kernel.org +Cc: srinivas.eeda@oracle.com +Cc: stable +Cc: x86-ml +Link: https://lkml.kernel.org/r/20181210163725.95977-1-chao.wang@ucloud.cn +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/cpu/bugs.c | 2 +- + include/linux/compiler-gcc.h | 2 +- + include/linux/module.h | 2 +- + scripts/mod/modpost.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/x86/kernel/cpu/bugs.c ++++ b/arch/x86/kernel/cpu/bugs.c +@@ -213,7 +213,7 @@ static enum spectre_v2_mitigation spectr + static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = + SPECTRE_V2_USER_NONE; + +-#ifdef RETPOLINE ++#ifdef CONFIG_RETPOLINE + static bool spectre_v2_bad_module; + + bool retpoline_module_ok(bool has_retpoline) +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -68,7 +68,7 @@ + */ + #define uninitialized_var(x) x = x + +-#ifdef RETPOLINE ++#ifdef CONFIG_RETPOLINE + #define __noretpoline __attribute__((__indirect_branch__("keep"))) + #endif + +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -817,7 +817,7 @@ static inline void module_bug_finalize(c + static inline void module_bug_cleanup(struct module *mod) {} + #endif /* CONFIG_GENERIC_BUG */ + +-#ifdef RETPOLINE ++#ifdef CONFIG_RETPOLINE + extern bool retpoline_module_ok(bool has_retpoline); + #else + static inline bool retpoline_module_ok(bool has_retpoline) +--- a/scripts/mod/modpost.c ++++ b/scripts/mod/modpost.c +@@ -2157,7 +2157,7 @@ static void add_intree_flag(struct buffe + /* Cannot check for assembler */ + static void add_retpoline(struct buffer *b) + { +- buf_printf(b, "\n#ifdef RETPOLINE\n"); ++ buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n"); + buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n"); + buf_printf(b, "#endif\n"); + }