From patchwork Mon Apr 5 00:30:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A3AFC433ED for ; Mon, 5 Apr 2021 00:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69A4D61393 for ; Mon, 5 Apr 2021 00:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbhDEAbj (ORCPT ); Sun, 4 Apr 2021 20:31:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52799 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbhDEAbX (ORCPT ); Sun, 4 Apr 2021 20:31:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eT2Kw0o0cAWXswb/IL3LKCNaV7EY6BT3R09FaXJ8el8=; b=iewhlnio6/sr+8w64VFUgEUib3e4ymjcisfMp02Jlgz36tpnm1M6QIMK1EfdnxLmXT2YGk Y0sDIUI5udBAbFmA+dHbkWArIKr7dbk3ILXQtp89MA7xqquOzvd4kN+bGAzTKgsqTvuYVn zeGEeTyk6WKXrfp6cFEXq7e+7RcoC7U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-_xPGuXZ_Me6M5-BNG6lpSg-1; Sun, 04 Apr 2021 20:31:14 -0400 X-MC-Unique: _xPGuXZ_Me6M5-BNG6lpSg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D9306B9C0; Mon, 5 Apr 2021 00:31:13 +0000 (UTC) Received: from carbon.redhat.com (ovpn-113-102.rdu2.redhat.com [10.10.113.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BEA637DD; Mon, 5 Apr 2021 00:31:12 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 14/15] net: ieee802154: forbid monitor for del llsec seclevel Date: Sun, 4 Apr 2021 20:30:53 -0400 Message-Id: <20210405003054.256017-15-aahringo@redhat.com> In-Reply-To: <20210405003054.256017-1-aahringo@redhat.com> References: <20210405003054.256017-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org This patch forbids to del llsec seclevel for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Reported-by: syzbot+fbf4fc11a819824e027b@syzkaller.appspotmail.com Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index 28427ce52a9b..effc4c1a4780 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -2133,6 +2133,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb, struct wpan_dev *wpan_dev = dev->ieee802154_ptr; struct ieee802154_llsec_seclevel sl; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], &sl) < 0)