Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp845162pxb; Thu, 15 Apr 2021 07:57:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/tmq6CQrVIPSARQ+Q0zhElvyOU6N4zmHE0WrjU6IShONBwK4u8ntSFcoskXjLJGNNOQof X-Received: by 2002:a17:90a:af8b:: with SMTP id w11mr4315832pjq.149.1618498673691; Thu, 15 Apr 2021 07:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498673; cv=none; d=google.com; s=arc-20160816; b=WyzhjQsFYnhPsPuHP6UA+yEWmaFD/+lE3mF3kCdAmSlLyZbCyRXtIzx35wAWRLTdAs CpCECjmfhk/QkboHslbyegmzDUrDQiO8MVcnyuMgiEAFRYkAZJfxKDFFTPZTISAx3ATU pAJjPC+JbOT1nykkqk7KvWYBP/jgHyyCYTV7iJO52RZCZ7M54H/XTACGS3/dWJPaewqW +GzOtssgrBbcFDbPB5iUXhoNqB8XwFzRASdCrYcIxSezAyZeE/tsluvE5XSlJ0bxivzB ALKx3P9WMexTvDegduwar45dYOhY/FM7Ox9mz+SHQEkibfGcZhDY7rEPNp0NPn3W4toj TCOQ== 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=hl++bUUHwHbU/TzPy2jwVT+81w8syFwhSExmdDSLC7g=; b=iFA9T7al/poieiyY3fHuxCfjnkuRNr18e+swjXEDGGnul9GOS0ZIs9OY7O8W/0M+64 kMeVyh26iajpE6K37RsWArh6fJ+ucKiGCnpCNEeHhdvst1gmZwzkxayyvGBh9PKNievd Cr+EwMNTeYzMjFkGKUkmXLCU2S0MfApgIsYhCtRB8lIQsHEHC3yRGfNRURKh6/XIDD1c APc9+XsWcQiwSTyvP8TsvQLUeqPPcgea1roYfBuMKWdUDB+74/Ag6Gdqdndg3M+fvLD4 o6oDJjOEn7pC+QyotBKWcvfwuGv89aApvVs4k9J15qUZRYxM9m1istb0Ft4Vb3metB0N ooyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cdQe/ir1"; 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 na4si3444327pjb.117.2021.04.15.07.57.40; Thu, 15 Apr 2021 07:57:53 -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="cdQe/ir1"; 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 S233557AbhDOO42 (ORCPT + 99 others); Thu, 15 Apr 2021 10:56:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:39954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbhDOOwG (ORCPT ); Thu, 15 Apr 2021 10:52:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB0E961131; Thu, 15 Apr 2021 14:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618498303; bh=WLwkVW7ARwuad7wlX3HpAR9iso5njstDWOSAv4yxZac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdQe/ir1copZynptqPJV73X4VifZv80NvZZd8jF7MRNEH5BMDpWw+/xyGeUA/21Nw HxjicLiRL0rlKn6Q6rRNd76pS/xC1aq3iVzFTj8+wNpJ3yu56L22EWs19VCmeLB56N x1D1Fw63+NJGRtiZbN6HAhyWr7iHXqk+A6Xi93GU= 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.9 37/47] net: ieee802154: fix nl802154 add llsec key Date: Thu, 15 Apr 2021 16:47:29 +0200 Message-Id: <20210415144414.646084458@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415144413.487943796@linuxfoundation.org> References: <20210415144413.487943796@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 @@ -1577,7 +1577,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)) return -EINVAL;