From patchwork Thu May 26 13:07:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baozeng X-Patchwork-Id: 9136977 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 2C0326075C for ; Thu, 26 May 2016 13:07:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DB1D282F7 for ; Thu, 26 May 2016 13:07:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F3D7282FC; Thu, 26 May 2016 13:07:54 +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 308DC282F7 for ; Thu, 26 May 2016 13:07:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753652AbcEZNHv (ORCPT ); Thu, 26 May 2016 09:07:51 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33979 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753499AbcEZNHu (ORCPT ); Thu, 26 May 2016 09:07:50 -0400 Received: by mail-pa0-f68.google.com with SMTP id yl2so8993677pac.1; Thu, 26 May 2016 06:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:subject:cc:from:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=LRDQOxVR4AQqV6CQghCGv92MVY6WUJuPjj08XHfaySc=; b=WcYaLyzsjyVWZdDe97a2iPEp2iZiduijGjDbtUCBLIucerS5oQlx8mM6yX1AxizqsL 3qIwMH1/E2qYHaS5PWpt5Ov/pLRjEyXOJ/lwDnMbRvOhVXwtXHXBPYwjiHocLA3AUNNL 3sUA7tAlqYYqS6LMkWydsv/5Tk8e1Ys54QJVVMd08TSMoYU66mLhRDCeNW1Hs18eWUah YlqwpKO4XzFJVKuWQ1J74c1UX8gGuMKjZAYwKibTu5JmQnT6ruP+QqYPFsouOmRP71PO h2TNGSh/LUs3tFF8IBpObGXyvnqcuKLF88aEgdhQyUr9hxR9goXlc4LNjFgg74qXhz3/ xhMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:cc:from:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=LRDQOxVR4AQqV6CQghCGv92MVY6WUJuPjj08XHfaySc=; b=YnnRgvlDO5394YTtG+yKU2VidTom6+ct7LLS6Zq+2Eva85YIdyQLsxfc8ufjFmkU0C bKz9KjNjZosT8ftbZ30EsPNZOlJFbODxK7iV7a6MM/E9tZOtwV0lKfe/AgFd6EUCN9CM BwJOGwd4s5+vwlzzBtvSIjXQJXnT3fc1/gPgR+Q4mh/3SCdamV6+nmEMB2s30+n1yNnq d/ipY6XGr43IW5boLsV9VBtyYQG+kEAZOA8x8vD4drFGvNRtjcxXE9/QxQkaQPyEG5z+ 8cDWvdKEhdG35TmI+NPcvgCWfILmdN3vlg5Oi1mssbw/ocMktOHslHSMpOCpRZS+g4br V2hQ== X-Gm-Message-State: ALyK8tJbceLXZQIAzY5fPLETkTb+N+eCekM0t0KLnlD0hVRTCsvSLSpek7zyahlwqUICtA== X-Received: by 10.66.189.65 with SMTP id gg1mr13960108pac.148.1464268069927; Thu, 26 May 2016 06:07:49 -0700 (PDT) Received: from [10.8.0.5] ([104.156.239.137]) by smtp.gmail.com with ESMTPSA id a62sm6142315pfj.29.2016.05.26.06.07.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2016 06:07:49 -0700 (PDT) To: aar@pengutronix.de, davem@davemloft.net Subject: [PATCH net] ieee802154: fix logic error in ieee802154_llsec_parse_dev_addr Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org From: Baozeng Ding Message-ID: <7c36848d-28b5-87cc-f998-53cc2428a0a6@gmail.com> Date: Thu, 26 May 2016 21:07:42 +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 Reviewed-by: Stefan Schmidt --- 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;