Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2065379pxb; Mon, 12 Apr 2021 13:24:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQbRmhaoBANXLtQewnV5k+xhS8KutUZZeLFaGBBzBhZBuocxY+MnNgFm0DP8JH8eG/dSUW X-Received: by 2002:a63:5f54:: with SMTP id t81mr28250176pgb.283.1618259080421; Mon, 12 Apr 2021 13:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618259080; cv=none; d=google.com; s=arc-20160816; b=E0oLfEC0HLpJnKoCXrRnt6hhtKLjoi1OXoEtdKNU8cYQPmCjUEiJuXIYoUa3l7+Fc6 HbTP+OaYN1ruIgR6tidVHbpqZiW6Pt1yuhoyt9dyXeSBx9Wy9X++4X3CQ5nceEavwGXa KB0bf031LmLOob8pcmkT/zsHOZyg1AdqeOudziyi8OL/nEnXLdSxLLxFHzhdzLgYADJi kORjq2VZeNUpGnbaOMOEerV588egH4Yzx1hgpkbR1gk0oA8+JWSjbpawiIyCaykVPaEa pLoIWGfLUgowNR3oR7EK/c1aYUvn3fybmm4Vp+c+Rm9fLY5vnFSOnyn4IiiIrJyoz1Lj tvRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TdRMvnf4ifWCobBeXh+x6nblrNMhKVewmpvHvyrCPac=; b=0Jyogvbxh60N8TOmTKusFYyiyO7hVFYWFS4ilN9XTm4hs6FCrgNGt3QWMCYvJyMME+ O/V5D5pRxCRLk23O3N176zC8G6auWqKQ3QFtnQFaPba37d/hXInlYEMweIjAvi7+rJF/ w/RnOhCKntRjaqsCYqRossia9eJp6AJBmFfkEXHmblnmGmk8BjssyrpNgFTNUZAcDQva 0S9Xj/8qJbc7rvLH/nyWZG09Y2dbpl5ymJanayVwKb5grnmlj1L70Tf5d0wxjX2ISKrC yGiMzEWvha76IHTJpTx+ZTMRebgaeFUJErTGUG+jZ3eyITSQR57/Y5mYnRvEECngLr6b if7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGDCrAY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c73si14036831pfb.228.2021.04.12.13.24.28; Mon, 12 Apr 2021 13:24:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DGDCrAY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238428AbhDLI5w (ORCPT + 99 others); Mon, 12 Apr 2021 04:57:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:38250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238623AbhDLIuJ (ORCPT ); Mon, 12 Apr 2021 04:50:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 35ED961019; Mon, 12 Apr 2021 08:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217387; bh=HCvMjNcHxdUepbbkj7I7iigFubjhc9DOOvxARpZjOgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGDCrAY6jhW/RObk4IB/cVEcBhuZ8fr/S9RTaySDadI8QfwnTgsfvBwOLBXenqxDI IDk4x9XYnJSermxy14LF2ikktcToD0cJnZmwRSY11nYLU8Efuhs3VsqRr8CPI2iE/7 nUngrP7IiijN2jSybo/oHs4vcsoOXdnBf01GlePE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+368672e0da240db53b5f@syzkaller.appspotmail.com, Alexander Aring , Stefan Schmidt Subject: [PATCH 5.4 107/111] net: ieee802154: fix nl802154 del llsec devkey Date: Mon, 12 Apr 2021 10:41:25 +0200 Message-Id: <20210412084007.833309669@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084004.200986670@linuxfoundation.org> References: <20210412084004.200986670@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Aring commit 27c746869e1a135dffc2f2a80715bb7aa00445b4 upstream. This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_DEVKEY is not set by the user. If this is the case nl802154 will return -EINVAL. Reported-by: syzbot+368672e0da240db53b5f@syzkaller.appspotmail.com Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20210221174321.14210-4-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Greg Kroah-Hartman --- net/ieee802154/nl802154.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1932,7 +1932,8 @@ static int nl802154_del_llsec_devkey(str struct ieee802154_llsec_device_key key; __le64 extended_addr; - if (nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) + if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || + nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) return -EINVAL; if (!attrs[NL802154_DEVKEY_ATTR_EXTENDED_ADDR])