Skip to content

Commit 61ce046

Browse files
Stuart Hayesij-intel
authored andcommitted
platform/x86: dell_rbu: Fix list usage
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: d19f359 ("platform/x86: dell_rbu: don't open code list_for_each_entry*()") Signed-off-by: Stuart Hayes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent a2f32c7 commit 61ce046

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/x86/dell/dell_rbu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static int packet_read_list(char *data, size_t * pread_length)
292292
remaining_bytes = *pread_length;
293293
bytes_read = rbu_data.packet_read_count;
294294

295-
list_for_each_entry(newpacket, (&packet_data_head.list)->next, list) {
295+
list_for_each_entry(newpacket, &packet_data_head.list, list) {
296296
bytes_copied = do_packet_read(pdest, newpacket,
297297
remaining_bytes, bytes_read, &temp_count);
298298
remaining_bytes -= bytes_copied;
@@ -315,7 +315,7 @@ static void packet_empty_list(void)
315315
{
316316
struct packet_data *newpacket, *tmp;
317317

318-
list_for_each_entry_safe(newpacket, tmp, (&packet_data_head.list)->next, list) {
318+
list_for_each_entry_safe(newpacket, tmp, &packet_data_head.list, list) {
319319
list_del(&newpacket->list);
320320

321321
/*

0 commit comments

Comments
 (0)