[PATCH 2/2] net: ieee802154: fix null deref in parse key id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix a logic error that could result in a null deref if the user does not
set the PAN ID but does set the address.

Signed-off-by: Dan Robertson <dan@xxxxxxxxxxxxxxx>
---
 net/ieee802154/nl-mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index 9c640d670ffe..66983c5d4d85 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -551,7 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
 	desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]);
 
 	if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) {
-		if (!info->attrs[IEEE802154_ATTR_PAN_ID] &&
+		if (!info->attrs[IEEE802154_ATTR_PAN_ID] ||
 		    !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] ||
 		      info->attrs[IEEE802154_ATTR_HW_ADDR]))
 			return -EINVAL;
-- 
2.31.1




[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux