[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230923122402.33851-1-liuhaoran14@163.com>
Date: Sat, 23 Sep 2023 20:24:02 +0800
From: liuhaoran <liuhaoran14@....com>
To: davem@...emloft.net
Cc: edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org,
liuhaoran <liuhaoran14@....com>
Subject: [PATCH] net: hsr: Add error handling in hsr_portdev_setup()
This patch adds error-handling for the hsr_port_get_hsr()
inside the hsr_portdev_setup().
Signed-off-by: liuhaoran <liuhaoran14@....com>
---
net/hsr/hsr_slave.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index e5742f2a2d52..ac7d6bdef47e 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -141,6 +141,10 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
}
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
+
+ if (!master)
+ return -ENODEV;
+
hsr_dev = master->dev;
res = netdev_upper_dev_link(dev, hsr_dev, extack);
--
2.17.1
Powered by blists - more mailing lists