From patchwork Thu May 26 13:00:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baozeng X-Patchwork-Id: 9136969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C57A36075A for ; Thu, 26 May 2016 13:00:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B833427B33 for ; Thu, 26 May 2016 13:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACE09282F8; Thu, 26 May 2016 13:00:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C4C27B33 for ; Thu, 26 May 2016 13:00:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753845AbcEZNAX (ORCPT ); Thu, 26 May 2016 09:00:23 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:36342 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753499AbcEZNAW (ORCPT ); Thu, 26 May 2016 09:00:22 -0400 Received: by mail-pa0-f65.google.com with SMTP id fg1so8981031pad.3; Thu, 26 May 2016 06:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=LRDQOxVR4AQqV6CQghCGv92MVY6WUJuPjj08XHfaySc=; b=apE5shWK09wUFAmYHgGugLqE6u0inKvzWCvcZh0K3f/cpN4Cj30RUGlG2v80BdKo4T m3cefPM/nTVno3VsGSDAvAPdMmW1pce6m8K33AzOW+HyhuZAnbJGw7Pct4sLT4iVUiXt kY2ydZ3b8iW6Cx8B53qVZnljUoGnB4UcllzzV3rJy2WWZ4jiprjh8O0b5Bj4gig/WQIJ np1SZbA6UfHNgIC4kvwMIfamiF0sCloLlSAK9tQRnH/ENy5qlasZwmGdblPggoXQUSov Wy0u2J8n8vYORHB11FVNhOAfPiU1E88FY1JDyiZiUTmCmcjUm6IOBSX6Jd7fCba7Xv2l t4AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=LRDQOxVR4AQqV6CQghCGv92MVY6WUJuPjj08XHfaySc=; b=SQlNqOVhBgD3kr6Q6WXv63boFZTD4gsX37p9EEL+0thLdf+P/t7RYCKEBtIcNxqUxM fGfGDZR3N9K4u72jlv02bvwuHnUKJHWITAOxKXDRfDCYqf/mimVL6rdDTKuDZP0C9te0 7MUGm+BVwl+nwW0bQKjxAl/2zgTGV/PI8i0FGoH7CuqqRV0iRV29FeggKO+Vot9dn3Rg dPRCBsOgqCHCwIH3V5s3ghULuwY+LPWSG7qBI9303I5XHSLc4pSCAZwCVtrCCFEJHtZ7 pvrqY06uXWfsn6/idFbRgzuDv0asQlMTRCknyZCYWW2LLk4tc8aqqUUalBocspM4+Awt mPew== X-Gm-Message-State: ALyK8tKDv4ABgEcE8pi3nBlG5XB37LS9CGAUymqCyGr8b7AzNtpxFkRr0Ui+ikJZQtKb5Q== X-Received: by 10.66.63.104 with SMTP id f8mr13816188pas.109.1464267620961; Thu, 26 May 2016 06:00:20 -0700 (PDT) Received: from [10.8.0.5] ([104.156.239.137]) by smtp.gmail.com with ESMTPSA id i75sm6078877pfj.51.2016.05.26.06.00.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2016 06:00:20 -0700 (PDT) From: Baozeng Ding To: aar@pengutronix.de, davem@davemloft.net Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net] ieee802154: fix logic error in, ieee802154_llsec_parse_dev_addr Message-ID: Date: Thu, 26 May 2016 21:00:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a logic error to avoid potential null pointer dereference. Signed-off-by: Baozeng Ding --- 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;