[PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr
Subsystems:
ieee 802.15.4 subsystem, networking [general], the rest
STALE3720d
3 messages,
3 authors,
2016-05-30 · open the first message on its own page
Fix a logic error to avoid potential null pointer dereference.
Signed-off-by: Baozeng Ding <redacted>
---
net/ieee802154/nl802154.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index ca207db..116187b 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1289,8 +1289,8 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
nl802154_dev_addr_policy))
return -EINVAL;
- if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] &&
- !attrs[NL802154_DEV_ADDR_ATTR_MODE] &&
+ if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
+ !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
!(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
return -EINVAL;
--
1.9.1
Hello.
On 26/05/16 15:07, Baozeng Ding wrote:
quoted hunk
Fix a logic error to avoid potential null pointer dereference.
Signed-off-by: Baozeng Ding<redacted>
---
net/ieee802154/nl802154.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index ca207db..116187b 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1289,8 +1289,8 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
nl802154_dev_addr_policy))
return -EINVAL;
- if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] &&
- !attrs[NL802154_DEV_ADDR_ATTR_MODE] &&
+ if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
+ !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
!(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
return -EINVAL;
Good catch!
Reviewed-by: Stefan Schmidt<redacted>
regards
Stefan Schmidt
From: Baozeng Ding <redacted>
Date: Thu, 26 May 2016 21:07:42 +0800
Fix a logic error to avoid potential null pointer dereference.
Signed-off-by: Baozeng Ding <redacted>
Applied.