From 7d38f5088f1feeeb7191a560959ebd688e679596 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 21 Apr 2025 13:40:43 +0200 Subject: [PATCH] 5.4-stable patches added patches: asus-laptop-fix-an-uninitialized-variable.patch writeback-fix-false-warning-in-inode_to_wb.patch --- ...laptop-fix-an-uninitialized-variable.patch | 56 +++++++++++++++++++ queue-5.4/series | 2 + ...ack-fix-false-warning-in-inode_to_wb.patch | 37 ++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 queue-5.4/asus-laptop-fix-an-uninitialized-variable.patch create mode 100644 queue-5.4/writeback-fix-false-warning-in-inode_to_wb.patch diff --git a/queue-5.4/asus-laptop-fix-an-uninitialized-variable.patch b/queue-5.4/asus-laptop-fix-an-uninitialized-variable.patch new file mode 100644 index 0000000000..f49f20afb7 --- /dev/null +++ b/queue-5.4/asus-laptop-fix-an-uninitialized-variable.patch @@ -0,0 +1,56 @@ +From 6c683c6887e4addcd6bd1ddce08cafccb0a21e32 Mon Sep 17 00:00:00 2001 +From: Denis Arefev +Date: Thu, 3 Apr 2025 15:26:01 +0300 +Subject: asus-laptop: Fix an uninitialized variable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Denis Arefev + +commit 6c683c6887e4addcd6bd1ddce08cafccb0a21e32 upstream. + +The value returned by acpi_evaluate_integer() is not checked, +but the result is not always successful, so it is necessary to +add a check of the returned value. + +If the result remains negative during three iterations of the loop, +then the uninitialized variable 'val' will be used in the clamp_val() +macro, so it must be initialized with the current value of the 'curr' +variable. + +In this case, the algorithm should be less noisy. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: b23910c2194e ("asus-laptop: Pegatron Lucid accelerometer") +Cc: stable@vger.kernel.org +Signed-off-by: Denis Arefev +Link: https://lore.kernel.org/r/20250403122603.18172-1-arefev@swemel.ru +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/asus-laptop.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/platform/x86/asus-laptop.c ++++ b/drivers/platform/x86/asus-laptop.c +@@ -428,11 +428,14 @@ static int asus_pega_lucid_set(struct as + + static int pega_acc_axis(struct asus_laptop *asus, int curr, char *method) + { ++ unsigned long long val = (unsigned long long)curr; ++ acpi_status status; + int i, delta; +- unsigned long long val; +- for (i = 0; i < PEGA_ACC_RETRIES; i++) { +- acpi_evaluate_integer(asus->handle, method, NULL, &val); + ++ for (i = 0; i < PEGA_ACC_RETRIES; i++) { ++ status = acpi_evaluate_integer(asus->handle, method, NULL, &val); ++ if (ACPI_FAILURE(status)) ++ continue; + /* The output is noisy. From reading the ASL + * dissassembly, timeout errors are returned with 1's + * in the high word, and the lack of locking around diff --git a/queue-5.4/series b/queue-5.4/series index 31b2012bc5..f104e66659 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -91,3 +91,5 @@ bluetooth-btrtl-prevent-potential-null-dereference.patch revert-wifi-mac80211-update-skb-s-control-block-key-.patch net-openvswitch-fix-nested-key-length-validation-in-.patch net-b53-enable-bpdu-reception-for-management-port.patch +writeback-fix-false-warning-in-inode_to_wb.patch +asus-laptop-fix-an-uninitialized-variable.patch diff --git a/queue-5.4/writeback-fix-false-warning-in-inode_to_wb.patch b/queue-5.4/writeback-fix-false-warning-in-inode_to_wb.patch new file mode 100644 index 0000000000..91bac3a8cc --- /dev/null +++ b/queue-5.4/writeback-fix-false-warning-in-inode_to_wb.patch @@ -0,0 +1,37 @@ +From 9e888998ea4d22257b07ce911576509486fa0667 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher +Date: Sat, 12 Apr 2025 18:39:12 +0200 +Subject: writeback: fix false warning in inode_to_wb() + +From: Andreas Gruenbacher + +commit 9e888998ea4d22257b07ce911576509486fa0667 upstream. + +inode_to_wb() is used also for filesystems that don't support cgroup +writeback. For these filesystems inode->i_wb is stable during the +lifetime of the inode (it points to bdi->wb) and there's no need to hold +locks protecting the inode->i_wb dereference. Improve the warning in +inode_to_wb() to not trigger for these filesystems. + +Link: https://lkml.kernel.org/r/20250412163914.3773459-3-agruenba@redhat.com +Fixes: aaa2cacf8184 ("writeback: add lockdep annotation to inode_to_wb()") +Signed-off-by: Jan Kara +Signed-off-by: Andreas Gruenbacher +Reviewed-by: Andreas Gruenbacher +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/backing-dev.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/linux/backing-dev.h ++++ b/include/linux/backing-dev.h +@@ -344,6 +344,7 @@ static inline struct bdi_writeback *inod + { + #ifdef CONFIG_LOCKDEP + WARN_ON_ONCE(debug_locks && ++ (inode->i_sb->s_iflags & SB_I_CGROUPWB) && + (!lockdep_is_held(&inode->i_lock) && + !lockdep_is_held(&inode->i_mapping->i_pages.xa_lock) && + !lockdep_is_held(&inode->i_wb->list_lock))); -- 2.47.3