Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2065205pxb; Mon, 12 Apr 2021 13:24:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIQDCI7IU6ku5n/KQAptRHB7n9GZaIQXpJaXxGLuU2UiUYo0Nj8+YjO+Fi7zVeh8Q/cHH7 X-Received: by 2002:a05:6402:1498:: with SMTP id e24mr30263725edv.176.1618259064361; Mon, 12 Apr 2021 13:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618259064; cv=none; d=google.com; s=arc-20160816; b=WDeJd//vIFvi6wvbZkBeQRqKK1T78dnZH0fsVJn3fl1LjVgBQ9r1XP+W9zVR5qZtO/ YTieXY1K2Gmh5e0OeK3jOLLmAc5fYzbaFOP1Cdu+d7HKvec7UlsuLgZ9j71gdJdGzv+F jDK+I2mjIRqXYKYcwVkhWBbEQwpGNNk76w6OC7KYERK0rBvABYI8VGXNvXiaJ3gL9dtt YKXglYbg7X5LfGwALcywALH35fYjA2k335csqD9dsT/VqVYyotbw1x8ajsqZ7liTHi+U EmlGyGVOo15Siju73CNe2R9HcZfzp3WbNbS1Hfeof/crRX1T5n/nF5eVM5Th5jm3kUaH by8g== 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=uc43oMiN3vWnevxWcw3qLeEhnKkSv5Cgc2fX9xSiU5A=; b=W1jpM5C10+3BZ7JcYYbWxs+3JvdtgUCGCadUi2fs1HFiwhc548ieLn0nk5XVAWfK2L zljecDRsO2O0qRsQ//NmBu5FIZyX7VxbNADS+/TVD2On2PjmTyBFyQydWE8tsZyC5G/a +XOl1Bp6Ct/oT23j7upF+TbJfoPzPek0nuvm9lb1aFBVHdxFoeo85IJFR6eDW8qNjjXx QL+L1U26NBGTtlLrzBLVmUzcHvfZwxHz3yyZwkuE5eO8vMZir4U0WEBsQGunNUhZuioy exzgyZq5VEk3f2tj7kbtzk6iPC7ph/Vh3c6R8mbSNjWy7+UIgrnAL9TFsfIJWtw7glV8 MQzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h+DO0XAK; 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 s21si7452562ejm.689.2021.04.12.13.24.00; Mon, 12 Apr 2021 13:24:24 -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=h+DO0XAK; 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 S238818AbhDLI5u (ORCPT + 99 others); Mon, 12 Apr 2021 04:57:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238611AbhDLIuI (ORCPT ); Mon, 12 Apr 2021 04:50:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9CA4961221; Mon, 12 Apr 2021 08:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217382; bh=FDWx6F5OkjSE7dQ+3oBToYlI7MIe/EedNh2AH8qETZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+DO0XAKlJ0HMLa78BXu74eWWihysTVb9LZEfb7gz2UCOi1yswTDTkHLtwl1+JMMm 6JQkiDFjt7DSZxmABqw5U5nNbMMWsLWQAcrNd3T0JGa3js7iZ668BHBc36iq9k+RQE /ltxbYmksi2VYp4X0EBfEAQFnGkez7MrfexLdqFs= 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.4 106/111] net: ieee802154: fix nl802154 add llsec key Date: Mon, 12 Apr 2021 10:41:24 +0200 Message-Id: <20210412084007.802904840@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 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 @@ -1560,7 +1560,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] ||