Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1595139pxb; Mon, 12 Apr 2021 01:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR8Hf04lVIUAeERyowPpNDWfYSZmbPOkP7W1aE73p3nqPW8ds/VfvFracDbB30AioRGRQ/ X-Received: by 2002:a17:902:dacd:b029:e5:cf71:3901 with SMTP id q13-20020a170902dacdb02900e5cf713901mr24547692plx.23.1618217272245; Mon, 12 Apr 2021 01:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618217272; cv=none; d=google.com; s=arc-20160816; b=DNs9rgnyUVsiO/AKMgfYlX4gzjThnig+LtO+RFMmouxRPBXb3AjMvcNXK7IMCHY864 Zp6MIpPlY+fCG6h7pREeHFEKxXBD35ZpD7uSJCGQ/TAXzesmgi7W6RvDzFS1X5tbuF8C VXQyQ3sfaRPtX8olKBAcq0116v1MWhLny1SrmjZibZvcLq6T78PZS9Jp0rltr6dNc3ak mW68cuWup6MR4/Kv3ACmeWqTf1CDBuUkLHfcu+1g6AcsOXvw13SK7/aR3fbb2TnTUHNm Z8DVWh19JQ0fLEySNwEy3BQkYJ/m3w0PAbdq1tmq/xbh9PHSqR765FevtThEwUnAOT2s DK5Q== 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=rpWGUp8GLH0WdWwEuq9p+mXe/fjlwupCEFS313igOrQ=; b=oi7qFCJYOfrd5rpgW4h++ancuOS6FIR79rSRKuVzY7OYqMhTmkbfMVA/IoXeUF2jUZ CXjJYvnfQ8Zp0IPSkuG0iOw8nIyZ8DNJ4rK9SLvIXOvZdjvP65/qsoiOV95xtcUHBuIa F84y1EHHf3EMTEj0iJxwbW0DQ4cFSZ/er7U/dWJPPAHMj801YfudyxWiAKd7yDxexx5c V1E+Y9lN8eHoq8ZkI6fz/0/9sVrP+jQGBKlnGaFZYvDoMrJv9FjT7NpUaTKjR66sByth ssPwsw0mnC3p3p/PqSonRczf+0RjDz72Fm/S1T3ZpmhRzz/4X0RrMCc+4QQo3i7MdQ7D DJqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YL3FlPD7; 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 123si13463910pgd.6.2021.04.12.01.47.40; Mon, 12 Apr 2021 01:47:52 -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=YL3FlPD7; 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 S237841AbhDLIqH (ORCPT + 99 others); Mon, 12 Apr 2021 04:46:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:36600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237630AbhDLIo5 (ORCPT ); Mon, 12 Apr 2021 04:44:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 888AA61287; Mon, 12 Apr 2021 08:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217080; bh=GWGz+tC6QB1hQh3N5TUcM5JIh2d2tA0KhkpWWVJHwrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YL3FlPD7i1n81otX8C/s2A7C+rzrjWXJEWN6fIVYeqO2H3VANxRzTUcHrW8xR7YDc pJNmTnBZYzDC19tWDumo0XoSfyOs1Amq0w5hG1LXgc2QZqrWzRXFTHewzW2Kq8vJ8D huVRyZHC3w9EebidFs8E0IQoVt+vdbjHQRdecZlU= 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 4.19 61/66] net: ieee802154: fix nl802154 add llsec key Date: Mon, 12 Apr 2021 10:41:07 +0200 Message-Id: <20210412084000.097298461@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412083958.129944265@linuxfoundation.org> References: <20210412083958.129944265@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 @@ -1562,7 +1562,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(attrs, NL802154_KEY_ATTR_MAX, + if (!info->attrs[NL802154_ATTR_SEC_KEY] || + nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_KEY], nl802154_key_policy, info->extack)) return -EINVAL;