Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1624812pxb; Mon, 12 Apr 2021 02:44:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlbUTgkJlsB07mzOCygTGea+9Rb+x/uoxSoAubhmd/adbOO8jJZvo5wQw719X85fPuolYe X-Received: by 2002:a17:90a:a78c:: with SMTP id f12mr21284970pjq.219.1618220652967; Mon, 12 Apr 2021 02:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618220652; cv=none; d=google.com; s=arc-20160816; b=yBHNl/k1MGNIUVGoW3uTVFr9eD0abUS6Rj0fpzmo8G2/tGsvFc+QQecCABOkRyPBd1 vxmOLLKxXYAN8AFN185r6Buk+OEWhj1IdzYdB+B1VvBMfHI7IQeQpS3i3hqP6pCzJjXd u/wx6DtzdSx9IeWewlFIYRRBK8nF6ZeBnQo70XYiMKNDLYt5xYvtpTW27OsqNajwkTq6 YVNO/7dzCDZkvI+sgnnCC91ReQ90aLbAOBaZvlQhe9BsmF363EaARNbWKBjQLNhZ0Wq7 WgzHg6SlIHZaxYrl6Y2p5Nf/l/JVdshCHSTtvcV+6bts9EDTHGMEsXOqwyNEyGGoPB5Y bgfw== 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=NU+2hhYb3XbxvW0WSsjySDnJYkbNxMw7SCNLdcoG740=; b=WxvwczZoWTxhFX0TdVf7shf6viH2O4VM2FzcQHeFOC9RD95RVHiM9adzWrDWUefA7S i5lqgJAgKKKaP+sJ4pSolXLUzvox0tdhhPXGnRtpeAtpb6X9an7vGD9MP9HK03E9DeEe aw+m2e7zthWSecQJVLvND1wvL9MaKVlAGUw0VwXaAPJLQxqa0IIn8iV/0OKYZ30HY+Vb JLdGIVtN/Umu3p+yFtgeDNEUjTBB0Z6Er3ErSUEtjoRLDJLQ1o2ossv67V2g1nCuDA6+ SA6G+o1VSxnLSTo1FMYSECSgGyHqqFmRaztPhznQm2NCFbZJqcFMXfMATOwA7H0UuASv TWwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xv4cyhdV; 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 b7si12953782plr.271.2021.04.12.02.44.01; Mon, 12 Apr 2021 02:44:12 -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=xv4cyhdV; 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 S243087AbhDLJlR (ORCPT + 99 others); Mon, 12 Apr 2021 05:41:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:34282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241001AbhDLJLX (ORCPT ); Mon, 12 Apr 2021 05:11:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01B1F613B6; Mon, 12 Apr 2021 09:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218474; bh=Xi9CV/Pr9Z+Uy9JQ5IW4ozpJbxhLGXtsRnMMgblsTio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xv4cyhdV3VH9kvbFc7aXoImHhuGomcucE6xnq30hSTnbMeIdhAhseg4if/wuSxrfm v7UgdRFHdLolTsT+gduEK2MS74yHnpld/cE4b/4mn4NKpUC+uY+5bfVCF0UQPiESud R6T00eDSHZjHKXMCmfIhCABPohdvhFw0muupnD34= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ce4e062c2d51977ddc50@syzkaller.appspotmail.com, Alexander Aring , Stefan Schmidt Subject: [PATCH 5.11 205/210] net: ieee802154: fix nl802154 add llsec key Date: Mon, 12 Apr 2021 10:41:50 +0200 Message-Id: <20210412084022.823738046@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@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 20d5fe2d7103f5c43ad11a3d6d259e9d61165c35 upstream. This patch fixes a nullpointer dereference if NL802154_ATTR_SEC_KEY is not set by the user. If this is the case nl802154 will return -EINVAL. Reported-by: syzbot+ce4e062c2d51977ddc50@syzkaller.appspotmail.com Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20210221174321.14210-3-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 @@ -1544,7 +1544,8 @@ static int nl802154_add_llsec_key(struct struct ieee802154_llsec_key_id id = { }; u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; - if (nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) + if (!info->attrs[NL802154_ATTR_SEC_KEY] || + nla_parse_nested_deprecated(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) return -EINVAL; if (!attrs[NL802154_KEY_ATTR_USAGE_FRAMES] ||