netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net] net: macb: Use rcu_dereference() for idev->ifa_list in macb_suspend().
@ 2024-08-08  4:00 Kuniyuki Iwashima
  2024-08-08  4:23 ` Vineeth Karumanchi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-08  4:00 UTC (permalink / raw)
  To: Nicolas Ferre, Claudiu Beznea, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Vineeth Karumanchi, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

In macb_suspend(), idev->ifa_list is fetched with rcu_access_pointer()
and later the pointer is dereferenced as ifa->ifa_local.

So, idev->ifa_list must be fetched with rcu_dereference().

Fixes: 0cb8de39a776 ("net: macb: Add ARP support to WOL")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 11665be3a22c..dcd3f54ed0cf 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5250,8 +5250,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
 	if (bp->wol & MACB_WOL_ENABLED) {
 		/* Check for IP address in WOL ARP mode */
 		idev = __in_dev_get_rcu(bp->dev);
-		if (idev && idev->ifa_list)
-			ifa = rcu_access_pointer(idev->ifa_list);
+		if (idev)
+			ifa = rcu_dereference(idev->ifa_list);
 		if ((bp->wolopts & WAKE_ARP) && !ifa) {
 			netdev_err(netdev, "IP address not assigned as required by WoL walk ARP\n");
 			return -EOPNOTSUPP;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-08-13  1:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08  4:00 [PATCH v1 net] net: macb: Use rcu_dereference() for idev->ifa_list in macb_suspend() Kuniyuki Iwashima
2024-08-08  4:23 ` Vineeth Karumanchi
2024-08-08  4:45   ` Kuniyuki Iwashima
2024-08-12  9:11     ` Vineeth Karumanchi
2024-08-12 18:35       ` Kuniyuki Iwashima
2024-08-13  1:40 ` Jakub Kicinski
2024-08-13  1:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).