netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ieee802154: fix logic error in, ieee802154_llsec_parse_dev_addr
@ 2016-05-26 13:00 Baozeng Ding
  0 siblings, 0 replies; 4+ messages in thread
From: Baozeng Ding @ 2016-05-26 13:00 UTC (permalink / raw)
  To: aar, davem; +Cc: linux-wpan, netdev

Fix a logic error to avoid potential null pointer dereference.

Signed-off-by: Baozeng Ding <sploving1@gmail.com>
---
 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

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

* [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr
@ 2016-05-26 13:07 Baozeng Ding
  2016-05-27 10:24 ` Stefan Schmidt
  2016-05-30  5:36 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Baozeng Ding @ 2016-05-26 13:07 UTC (permalink / raw)
  To: aar, davem; +Cc: linux-wpan, netdev

Fix a logic error to avoid potential null pointer dereference.

Signed-off-by: Baozeng Ding <sploving1@gmail.com>
---
 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

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

* Re: [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr
  2016-05-26 13:07 [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr Baozeng Ding
@ 2016-05-27 10:24 ` Stefan Schmidt
  2016-05-30  5:36 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2016-05-27 10:24 UTC (permalink / raw)
  To: Baozeng Ding, aar, davem; +Cc: linux-wpan, netdev

Hello.

On 26/05/16 15:07, Baozeng Ding wrote:
> Fix a logic error to avoid potential null pointer dereference.
>
> Signed-off-by: Baozeng Ding<sploving1@gmail.com>
> ---
>   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<stefan@osg.samsung.com>

regards
Stefan Schmidt

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

* Re: [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr
  2016-05-26 13:07 [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr Baozeng Ding
  2016-05-27 10:24 ` Stefan Schmidt
@ 2016-05-30  5:36 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-30  5:36 UTC (permalink / raw)
  To: sploving1; +Cc: aar, linux-wpan, netdev

From: Baozeng Ding <sploving1@gmail.com>
Date: Thu, 26 May 2016 21:07:42 +0800

> Fix a logic error to avoid potential null pointer dereference.
> 
> Signed-off-by: Baozeng Ding <sploving1@gmail.com>

Applied.

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

end of thread, other threads:[~2016-05-30  5:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-26 13:00 [PATCH net] ieee802154: fix logic error in, ieee802154_llsec_parse_dev_addr Baozeng Ding
  -- strict thread matches above, loose matches on Subject: below --
2016-05-26 13:07 [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr Baozeng Ding
2016-05-27 10:24 ` Stefan Schmidt
2016-05-30  5:36 ` David Miller

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).