[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1609324695-1516-1-git-send-email-wangyunjian@huawei.com>
Date: Wed, 30 Dec 2020 18:38:15 +0800
From: wangyunjian <wangyunjian@...wei.com>
To: <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <kuba@...nel.org>,
<jerry.lilijun@...wei.com>, <xudingke@...wei.com>,
Yunjian Wang <wangyunjian@...wei.com>
Subject: [PATCH net] macvlan: fix null pointer dereference in macvlan_changelink_sources()
From: Yunjian Wang <wangyunjian@...wei.com>
Currently pointer data is dereferenced when declaring addr before
pointer data is null checked. This could lead to a null pointer
dereference. Fix this by checking if pointer data is null first.
Fixes: 79cf79abce71 ("macvlan: add source mode")
Signed-off-by: Yunjian Wang <wangyunjian@...wei.com>
---
drivers/net/macvlan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index fb51329f8964..e412fd6b6798 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1356,7 +1356,7 @@ static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode,
struct nlattr *nla, *head;
struct macvlan_source_entry *entry;
- if (data[IFLA_MACVLAN_MACADDR])
+ if (data && data[IFLA_MACVLAN_MACADDR])
addr = nla_data(data[IFLA_MACVLAN_MACADDR]);
if (mode == MACVLAN_MACADDR_ADD) {
--
2.23.0
Powered by blists - more mailing lists