From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: linux-kernel@vger.kernel.org,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
platform-driver-x86@vger.kernel.org
Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Subject: [PATCH v4 2/5] platform/x86: dell_rbu: Fix list usage
Date: Mon, 9 Jun 2025 13:46:56 -0500 [thread overview]
Message-ID: <20250609184659.7210-3-stuart.w.hayes@gmail.com> (raw)
In-Reply-To: <20250609184659.7210-1-stuart.w.hayes@gmail.com>
Pass the correct list head to list_for_each_entry*() when looping through
the packet list.
Without this patch, reading the packet data via sysfs will show the data
incorrectly (because it starts at the wrong packet), and clearing the
packet list will result in a NULL pointer dereference.
Fixes: d19f359fbdc6 ("platform/x86: dell_rbu: don't open code list_for_each_entry*()")
Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
drivers/platform/x86/dell/dell_rbu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index 7b019fb72e86..722979b19e0e 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -292,7 +292,7 @@ static int packet_read_list(char *data, size_t * pread_length)
remaining_bytes = *pread_length;
bytes_read = rbu_data.packet_read_count;
- list_for_each_entry(newpacket, (&packet_data_head.list)->next, list) {
+ list_for_each_entry(newpacket, &packet_data_head.list, list) {
bytes_copied = do_packet_read(pdest, newpacket,
remaining_bytes, bytes_read, &temp_count);
remaining_bytes -= bytes_copied;
@@ -315,7 +315,7 @@ static void packet_empty_list(void)
{
struct packet_data *newpacket, *tmp;
- list_for_each_entry_safe(newpacket, tmp, (&packet_data_head.list)->next, list) {
+ list_for_each_entry_safe(newpacket, tmp, &packet_data_head.list, list) {
list_del(&newpacket->list);
/*
--
2.47.1
next prev parent reply other threads:[~2025-06-09 18:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-09 18:46 [PATCH v4 0/5] platform/x86: dell_rbu: Packet data fixes Stuart Hayes
2025-06-09 18:46 ` [PATCH v4 1/5] platform/x86: dell_rbu: Fix lock context warning Stuart Hayes
2025-06-09 18:46 ` Stuart Hayes [this message]
2025-06-09 18:46 ` [PATCH v4 3/5] platform/x86: dell_rbu: Remove unused struct Stuart Hayes
2025-06-10 7:52 ` Ilpo Järvinen
2025-06-09 18:46 ` [PATCH v4 4/5] platform/x86: dell_rbu: Stop overwriting data buffer Stuart Hayes
2025-06-09 18:46 ` [PATCH v4 5/5] platform/x86: dell_rbu: Bump version Stuart Hayes
2025-07-07 13:11 ` [PATCH v4 0/5] platform/x86: dell_rbu: Packet data fixes Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250609184659.7210-3-stuart.w.hayes@gmail.com \
--to=stuart.w.hayes@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.