[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1577364757-18385-1-git-send-email-xiyuyang19@fudan.edu.cn>
Date: Thu, 26 Dec 2019 20:52:37 +0800
From: xiyuyang19@...an.edu.cn
To: xiyuyang19@...an.edu.cn
Cc: yuanxzhang@...an.edu.cn, kjlu@....edu, leon@...nel.org,
Xin Tan <tanxin.ctf@...il.com>,
Faisal Latif <faisal.latif@...el.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] infiniband: i40iw: fix a potential NULL pointer dereference
From: Xiyu Yang <xiyuyang19@...an.edu.cn>
in_dev_get may return a NULL object. The fix handles the situation
by adding a check to avoid NULL pointer dereference on idev,
as pick_local_ipaddrs does.
Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
---
Changes in v2:
- Release rtnl lock when in_dev_get return NULL
drivers/infiniband/hw/i40iw/i40iw_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index d44cf33d..d7146fdf 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -1225,6 +1225,10 @@ static void i40iw_add_ipv4_addr(struct i40iw_device *iwdev)
const struct in_ifaddr *ifa;
idev = in_dev_get(dev);
+ if (!idev) {
+ i40iw_pr_err("ipv4 inet device not found\n");
+ break;
+ }
in_dev_for_each_ifa_rtnl(ifa, idev) {
i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM,
"IP=%pI4, vlan_id=%d, MAC=%pM\n", &ifa->ifa_address,
--
2.7.4
Powered by blists - more mailing lists