Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2037819pxb; Mon, 12 Apr 2021 12:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvXlxo+GOlw3XRTSnbNBDFZL4cLY06pfWO/JFYuQFmbohEMwSAQUK1QL060jNODRBW2J7/ X-Received: by 2002:a05:6402:1853:: with SMTP id v19mr30533290edy.179.1618256286774; Mon, 12 Apr 2021 12:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618256286; cv=none; d=google.com; s=arc-20160816; b=zPt99el0Qq9ujhPsglHmGu5UnPlJHDJSVgVM/otojGUOfa36lV5GEPHcHjL+8b95Dy snouuxXp6g+h+G+h7n1skweA8i9vSuF0+6FvOXlE2hEWzuihMiOvSmivZ+clrk5Uq6ov ynVFEwtbue/3ga1jLYCQRYW6w9KDgdK8yuXgHxX4rDIjAJ7DZcHvgRUa6Id28enrO+Ui 7/ZTCXadNegvqQKLNllIIP4VZ1ohUPM6zRP08g9a5gfGTkYj/AJvWQcMdfc866anomH1 UPtwZlguyoEgC9G+HC50rjpxsL8uPUFS/Ft3lLSyawmL9AyEK4yTtOtNPBhYitrOsCTW 1rcw== 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=cKXDY4SDzybotI42HfbL661OE6w0x5orbXO9ENkVOSk=; b=kFXVbM5SD7C9pA7gqeaqDJUs2tXl1sLDlZLcUEqlWmiY0lohenauKef3ssaJU83RMx NIUMrTkDNG5JpSgrU43bZhbJrcEo0ES+8+lWIIYUsjBdM9y20shcMQy08qNlSgrGKNfr bVSSqnVt8iFXdqjXeAxKtnqzWJ4RT6fKDcHQOyPPZ8h1YDPj/BBryPXT4RmFSN3YpUbH rS/uTyFSmSpaohZgZtgiOb6uqfSddm47e9c1WOIAT+Sz7jQ0fbyFU3WgWEuSFeTLGDGY 3tc5/Udekr+2oDUPyY3/sb4dyZNuAM2L5b9S2Fa+Ux0fi1+qRu/Res/pb4I9U2YDdP7f uqvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VbQQDcqh; 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 ay10si6229073ejb.482.2021.04.12.12.37.42; Mon, 12 Apr 2021 12:38:06 -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=VbQQDcqh; 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 S237716AbhDLIqA (ORCPT + 99 others); Mon, 12 Apr 2021 04:46:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:37032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237708AbhDLIot (ORCPT ); Mon, 12 Apr 2021 04:44:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37AF06120F; Mon, 12 Apr 2021 08:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217071; bh=VhEHj/HviD9Dsju+FmmmQwjT1cflWA6BCHPWVBv4tBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbQQDcqhkqqmTWi4+pX+YQVLPQy7TQK7JEsYVu7vVHjuHCoDEiePqDcHFf8VwrI+r 9X+QrW61KYN4JOmShqeIEQvbiHVrUQtsaU3UQGmYlnM/jyd7eMAfq0QCo52/V8k16p g98+nLrdTxEb8ujH6s7II2N6YEQZ0KOo1YfYVlso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ac5c11d2959a8b3c4806@syzkaller.appspotmail.com, Alexander Aring , Stefan Schmidt Subject: [PATCH 4.19 59/66] net: ieee802154: fix nl802154 del llsec key Date: Mon, 12 Apr 2021 10:41:05 +0200 Message-Id: <20210412084000.031810830@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 37feaaf5ceb2245e474369312bb7b922ce7bce69 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+ac5c11d2959a8b3c4806@syzkaller.appspotmail.com Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20210221174321.14210-1-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 @@ -1612,7 +1612,8 @@ static int nl802154_del_llsec_key(struct struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; struct ieee802154_llsec_key_id id; - 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;