From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9309242056; Mon, 23 Jun 2025 21:46:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750715183; cv=none; b=iWs/i8ip6jw6yxTm4V5uj5teVB/5YD6Qh0+uAVzlMJ2UBoiwkuaZmb1xHZhDxZM9b0aTSwu1oSpeB86uzX0hlVUBtoz2lj7hNyuRNYyiGGfxfowHL/g2h72RKwjNcmyQCxaiN2JPD9ONlnEECtinVPHDG8uf49gvvJeUFMh/V7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750715183; c=relaxed/simple; bh=CgHqgEpYTrx4A8Ucqo5HqTWqeRQl8jFuNzEBZ0uZ2+Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KspbA8iBmIwSm9Nm9nTxYPL9lMjwBtYyN8Mpz3EvjM2ssQ12j5XA8JKIcm0ojGcK4CyIg2WVdRGadpB1pFgIu8JEr5cvVM2Fdyjoa1oV23kMaKj0cIcTIHh7kB+z+nsHUSi1Sg/iRuVaQBt4nQkWcT+KkTOk3rK6QEZA88CHPU8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fsOYMJ4W; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fsOYMJ4W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2347CC4CEF0; Mon, 23 Jun 2025 21:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750715183; bh=CgHqgEpYTrx4A8Ucqo5HqTWqeRQl8jFuNzEBZ0uZ2+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fsOYMJ4WeFt52un8QR5ZBAbBfDc6ZFJWZKlpH6UUT5JjfLsKCNJEfT7OU3PrUDVqL YlMmUYU4SZANkfYrT4wzatWrcMLaFpbN1yKAfyP+7+gGj2ypUTZKGccb9Icf4Grglu Yl+arY1M9xX4WGYayNM6bpCiJjBKKM6LLM7/LRzI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Stuart Hayes , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 5.10 280/355] platform/x86: dell_rbu: Fix list usage Date: Mon, 23 Jun 2025 15:08:01 +0200 Message-ID: <20250623130635.198518106@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.716971725@linuxfoundation.org> References: <20250623130626.716971725@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stuart Hayes [ Upstream commit 61ce04601e0d8265ec6d2ffa6df5a7e1bce64854 ] 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 Link: https://lore.kernel.org/r/20250609184659.7210-3-stuart.w.hayes@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/dell_rbu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/dell_rbu.c b/drivers/platform/x86/dell_rbu.c index 03c3ff34bcf52..0b5c1a0260b7a 100644 --- a/drivers/platform/x86/dell_rbu.c +++ b/drivers/platform/x86/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.39.5