From patchwork Mon Apr 5 00:30:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182477 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 30CB1C433ED for ; Mon, 5 Apr 2021 00:31:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E18C56136A for ; Mon, 5 Apr 2021 00:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbhDEAbM (ORCPT ); Sun, 4 Apr 2021 20:31:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29119 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbhDEAbM (ORCPT ); Sun, 4 Apr 2021 20:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582666; 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=Dfw4ZRxqgfVUaJTec3AjfO7oo1Gb5lLdSHR4klxNszM=; b=dAt2P3mw++qHyRB2oEDS9vryeq2C4iTMGsXL3wx8acTmJZXnly9o4luLzuUeSNseiKUuXY dYr9zmiJe+WLPR7TVwKUi6UUvgbIarTcDt5ksUFkIOg5VexrH1XwJg5wpTheawln8goJeo hwPYveFbWMtq1Ij4STOAlf+6nvvgkw8= 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-513-9gQ-7ZK2Pzi8G5KnOpnE3A-1; Sun, 04 Apr 2021 20:31:04 -0400 X-MC-Unique: 9gQ-7ZK2Pzi8G5KnOpnE3A-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 BEAD981744F; Mon, 5 Apr 2021 00:31:03 +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 4ABB92B189; Mon, 5 Apr 2021 00:31:03 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 01/15] net: ieee802154: nl-mac: fix check on panid Date: Sun, 4 Apr 2021 20:30:40 -0400 Message-Id: <20210405003054.256017-2-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 fixes a null pointer derefence for panid handle by move the check for the netlink variable directly before accessing them. Reported-by: syzbot+d4c07de0144f6f63be3a@syzkaller.appspotmail.com Signed-off-by: Alexander Aring --- net/ieee802154/nl-mac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c index 9c640d670ffe..0c1b0770c59e 100644 --- a/net/ieee802154/nl-mac.c +++ b/net/ieee802154/nl-mac.c @@ -551,9 +551,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { - if (!info->attrs[IEEE802154_ATTR_PAN_ID] && - !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || - info->attrs[IEEE802154_ATTR_HW_ADDR])) + if (!info->attrs[IEEE802154_ATTR_PAN_ID]) return -EINVAL; desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); @@ -562,6 +560,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info, desc->device_addr.mode = IEEE802154_ADDR_SHORT; desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); } else { + if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) + return -EINVAL; + desc->device_addr.mode = IEEE802154_ADDR_LONG; desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); } From patchwork Mon Apr 5 00:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182479 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 1BB5EC433B4 for ; Mon, 5 Apr 2021 00:31:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9CF261393 for ; Mon, 5 Apr 2021 00:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231737AbhDEAbO (ORCPT ); Sun, 4 Apr 2021 20:31:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41294 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231728AbhDEAbM (ORCPT ); Sun, 4 Apr 2021 20:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582667; 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=VKmlmihN1pyfwAnaIDpYlq2V3E4fJ6sPiOz7N82rbjg=; b=HesRSwJnHq9sgzUd7U+5RezjxCWnZfK+ZxN/nOfqb9VM+9waYlZ2W0mV84ko6iS99mc2Mt qqI3VWUNvLnYARHK5Muy7mYlSPtGHNqeW1dI3t3df2Vu1Mr3YRQSI/GeHOXwF2BXVBrQvN ZxT/h7dNQRZXvVKE0JhGVrUnuO4oxqg= 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-146-s44d6bpyOTmEc5ecTs_tGQ-1; Sun, 04 Apr 2021 20:31:05 -0400 X-MC-Unique: s44d6bpyOTmEc5ecTs_tGQ-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 68F3C1853020; Mon, 5 Apr 2021 00:31:04 +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 E7C1C37DD; Mon, 5 Apr 2021 00:31:03 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 02/15] net: ieee802154: forbid monitor for set llsec params Date: Sun, 4 Apr 2021 20:30:41 -0400 Message-Id: <20210405003054.256017-3-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 set llsec params for monitor interfaces which we don't support yet. Reported-by: syzbot+8b6719da8a04beeafcc3@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 1600edb98107..ce8956f31ef9 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1384,6 +1384,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb, u32 changed = 0; int ret; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { u8 enabled; From patchwork Mon Apr 5 00:30:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182483 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 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 B4B94C433B4 for ; Mon, 5 Apr 2021 00:31:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 931F46136A for ; Mon, 5 Apr 2021 00:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231785AbhDEAb0 (ORCPT ); Sun, 4 Apr 2021 20:31:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37708 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231744AbhDEAbO (ORCPT ); Sun, 4 Apr 2021 20:31:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582669; 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=SMB8jZVQAr9/HLgYxfoV6B+Y6iLCp4LjTvctPXaLaCE=; b=WlMVkoOYY5tl8dmr0DQXp0PehSOCxpkLXNyzJa0MIeKlXiDwdFV8szBmgnuKfQnDE55XKO 4ljs54oFN8eUUnkeFC35/CHLv+RoAfZZyS2GClea/5uoCE5NA4Ii1SwXRza8x9FQ0lkfxd wKAxIe9u/7yKDgBjLUGC7a1hm+H22w8= 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-379-b1m8LBV1PRCiTSjAn7ao_w-1; Sun, 04 Apr 2021 20:31:07 -0400 X-MC-Unique: b1m8LBV1PRCiTSjAn7ao_w-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 D34ED6B9C1; Mon, 5 Apr 2021 00:31:05 +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 5DE9A37DD; Mon, 5 Apr 2021 00:31:04 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 03/15] net: ieee802154: stop dump llsec keys for monitors Date: Sun, 4 Apr 2021 20:30:42 -0400 Message-Id: <20210405003054.256017-4-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 stops dumping llsec keys for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index ce8956f31ef9..7815f253c8a3 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1493,6 +1493,11 @@ nl802154_dump_llsec_key(struct sk_buff *skb, struct netlink_callback *cb) if (err) return err; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { + err = skb->len; + goto out_err; + } + if (!wpan_dev->netdev) { err = -EINVAL; goto out_err; From patchwork Mon Apr 5 00:30:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182487 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 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 527DBC43460 for ; Mon, 5 Apr 2021 00:31:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 364956136A for ; Mon, 5 Apr 2021 00:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231749AbhDEAb1 (ORCPT ); Sun, 4 Apr 2021 20:31:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51426 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbhDEAbO (ORCPT ); Sun, 4 Apr 2021 20:31:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582669; 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=ud4bYnni5wEQFwEiFHnFrYnj2ZvW1WRv6DDO6B2Pe/0=; b=ADItpMP41nmVcSeSrIAAr/goZYC/DDkiLGTmi7SufY5MphoVhGUoWMkhTGuGlZ54J7IeZg +thkksptkWNudltRpEb7QcPch+CnIZR/bMrgSpS+MaQ8/kDMtyR+BDEQxtaZId9f4pX7zK R/jMx1xeRNIJX7XgLMWSRWqNyn8QsXQ= 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-551--Jd6-36CMzq8mlr7RQeeRA-1; Sun, 04 Apr 2021 20:31:07 -0400 X-MC-Unique: -Jd6-36CMzq8mlr7RQeeRA-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 A340B6B9C2; Mon, 5 Apr 2021 00:31:06 +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 0847D37DD; Mon, 5 Apr 2021 00:31:05 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 04/15] net: ieee802154: forbid monitor for add llsec key Date: Sun, 4 Apr 2021 20:30:43 -0400 Message-Id: <20210405003054.256017-5-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 add llsec key for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 7815f253c8a3..42a246b6f9cb 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1552,6 +1552,9 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info) struct ieee802154_llsec_key_id id = { }; u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + 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; From patchwork Mon Apr 5 00:30:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182485 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 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 D0677C433ED for ; Mon, 5 Apr 2021 00:31:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94F7F6136A for ; Mon, 5 Apr 2021 00:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbhDEAb1 (ORCPT ); Sun, 4 Apr 2021 20:31:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55653 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231749AbhDEAbP (ORCPT ); Sun, 4 Apr 2021 20:31:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582670; 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=tnSLsRPy7fHZnncoOcRalDHqIOYtKxrUOy+3tLNMXug=; b=FRdxX16kTvfIbw2KAT/4t0Y+/kIxTVRtIhPHcY6KqfQZdxEZ65BCH7f/z31KOb5B62O2dA 3D60lqbGjc4mQTbpK0au7vNnnyNlLp2nbQC9WJVaEx1g4ZS3seaJmpApabPtSmQnodSMFP W8g93x5p9TuBORJTwr47T6BtZd53mtE= 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-439-LBSdQQ-ePcGaa0u-SbHi5w-1; Sun, 04 Apr 2021 20:31:08 -0400 X-MC-Unique: LBSdQQ-ePcGaa0u-SbHi5w-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 4C674881278; Mon, 5 Apr 2021 00:31:07 +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 CBD7E37DD; Mon, 5 Apr 2021 00:31:06 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 05/15] net: ieee802154: forbid monitor for del llsec key Date: Sun, 4 Apr 2021 20:30:44 -0400 Message-Id: <20210405003054.256017-6-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 key for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 42a246b6f9cb..bfc0eca774e3 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1604,6 +1604,9 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info) struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; struct ieee802154_llsec_key_id id; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + 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; From patchwork Mon Apr 5 00:30:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182489 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 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 C1681C433B4 for ; Mon, 5 Apr 2021 00:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0AF66136A for ; Mon, 5 Apr 2021 00:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbhDEAb2 (ORCPT ); Sun, 4 Apr 2021 20:31:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30894 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbhDEAbQ (ORCPT ); Sun, 4 Apr 2021 20:31:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582670; 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=VfCnJkta+8F2c4fJv7y9YIk7W0E2kwmAy5zrFL0vAsw=; b=OXYveuZkJCtxRL//f5qyj2EIE6f7zqEReIBPF+O83c6kP+IvjbficNDqUCuxJtH2eM5PF5 rWlF4s+aSuenvHyTHcDA8/uv2wlQls5CUsU5CtY7czA3u1RReFgnPd3i6H1BvVsIyBdmZY HmSOpXC+V3q3RaNoyBK7ykWZCd13z7s= 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-226-l7QiYpoFOjSIz3rOvvxoMg-1; Sun, 04 Apr 2021 20:31:08 -0400 X-MC-Unique: l7QiYpoFOjSIz3rOvvxoMg-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 E9D541007468; Mon, 5 Apr 2021 00:31:07 +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 7568A37DD; Mon, 5 Apr 2021 00:31:07 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 06/15] net: ieee802154: stop dump llsec devs for monitors Date: Sun, 4 Apr 2021 20:30:45 -0400 Message-Id: <20210405003054.256017-7-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 stops dumping llsec devs for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index bfc0eca774e3..ef0becc9faa7 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1672,6 +1672,11 @@ nl802154_dump_llsec_dev(struct sk_buff *skb, struct netlink_callback *cb) if (err) return err; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { + err = skb->len; + goto out_err; + } + if (!wpan_dev->netdev) { err = -EINVAL; goto out_err; From patchwork Mon Apr 5 00:30:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182495 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 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 95653C433ED for ; Mon, 5 Apr 2021 00:31:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72A0A61393 for ; Mon, 5 Apr 2021 00:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbhDEAbc (ORCPT ); Sun, 4 Apr 2021 20:31:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20448 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231761AbhDEAbS (ORCPT ); Sun, 4 Apr 2021 20:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582673; 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=SO4Df76od9J3qY6ArWcM4V6PEGyI/35oBQG0O9zNE8c=; b=hMk5yO4WNzhd9F6JhkN0yejM0sYQDB0vepo24QPZjIG8wWJUmtxwmRz3u4KKU34hZyTtZ4 vSfcJGKfdbKVwAOKRf0cjBcEgzOmvHZMSOP2qr+UJHktv33ZyIJwe6lgXDin32hYqJuema dNDc8ibIDUK6QsAF6bopmaIC5Y+I/Uc= 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-76-S4sLU7gTOF6TD-zqSU6GIA-1; Sun, 04 Apr 2021 20:31:09 -0400 X-MC-Unique: S4sLU7gTOF6TD-zqSU6GIA-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 9420281744F; Mon, 5 Apr 2021 00:31:08 +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 1E7D737DD; Mon, 5 Apr 2021 00:31:08 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 07/15] net: ieee802154: forbid monitor for add llsec dev Date: Sun, 4 Apr 2021 20:30:46 -0400 Message-Id: <20210405003054.256017-8-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 add llsec dev for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 ef0becc9faa7..0d7dc9478b56 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1763,6 +1763,9 @@ static int nl802154_add_llsec_dev(struct sk_buff *skb, struct genl_info *info) struct wpan_dev *wpan_dev = dev->ieee802154_ptr; struct ieee802154_llsec_device dev_desc; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (ieee802154_llsec_parse_device(info->attrs[NL802154_ATTR_SEC_DEVICE], &dev_desc) < 0) return -EINVAL; From patchwork Mon Apr 5 00:30:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182491 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 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 BD98AC43460 for ; Mon, 5 Apr 2021 00:31:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95D816136A for ; Mon, 5 Apr 2021 00:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbhDEAba (ORCPT ); Sun, 4 Apr 2021 20:31:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37923 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231756AbhDEAbS (ORCPT ); Sun, 4 Apr 2021 20:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582671; 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=qegaL49eQ0ulAGqlQqr7hH6RdMrVNCo8k8O6Uq9V76E=; b=P5qmX1FOqCHYBE77C7nw9DbkK8f+WDUISDM08jVvw+ecb5Iea67ggZfv6kojauiglgDNNt Os+2v8gprQaJC/x2y385YCGTzGrwB9YeWcVCJExHoweSZ1X2C1v1JebypBGHh69S+p+uoh WAz11iqp437J5tAWwFoikAb/96m433M= 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-518--W0lacKHNAG3w7X0vgBtfw-1; Sun, 04 Apr 2021 20:31:10 -0400 X-MC-Unique: -W0lacKHNAG3w7X0vgBtfw-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 3C7CC6B9C1; Mon, 5 Apr 2021 00:31:09 +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 BCB8A37DD; Mon, 5 Apr 2021 00:31:08 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 08/15] net: ieee802154: forbid monitor for del llsec dev Date: Sun, 4 Apr 2021 20:30:47 -0400 Message-Id: <20210405003054.256017-9-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 dev for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 0d7dc9478b56..17c782d4cdae 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1781,6 +1781,9 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info) struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; __le64 extended_addr; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (!info->attrs[NL802154_ATTR_SEC_DEVICE] || nla_parse_nested_deprecated(attrs, NL802154_DEV_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVICE], nl802154_dev_policy, info->extack)) return -EINVAL; From patchwork Mon Apr 5 00:30:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182493 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 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 2C932C43461 for ; Mon, 5 Apr 2021 00:31:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06E9A61393 for ; Mon, 5 Apr 2021 00:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbhDEAbb (ORCPT ); Sun, 4 Apr 2021 20:31:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58666 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbhDEAbS (ORCPT ); Sun, 4 Apr 2021 20:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582672; 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=6N5hKnaT8IXFDBUYzrd332qy+xjid64X0u370o73asY=; b=WinhF4l8spIkdKD5RSyJLMjF1e52aD/9C9d1TALf35Nk6rHV6fnqrKqp0vOB+Pco5Yo41I mijLOFj/BsfCL2M1JzOD8VEttVuJnPN0pkAqWN+/5Vk0QzoOFfCriFaq0OSPgLThBrkN5S qGD7e9fCeaHQsjmsJwOYh5O3GJ2+Y/c= 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-152-0mSleKy2MdqWxexJ0G3nRQ-1; Sun, 04 Apr 2021 20:31:10 -0400 X-MC-Unique: 0mSleKy2MdqWxexJ0G3nRQ-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 D9EDB801814; Mon, 5 Apr 2021 00:31:09 +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 662802B0DC; Mon, 5 Apr 2021 00:31:09 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 09/15] net: ieee802154: stop dump llsec devkeys for monitors Date: Sun, 4 Apr 2021 20:30:48 -0400 Message-Id: <20210405003054.256017-10-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 stops dumping llsec devkeys for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index 17c782d4cdae..6f9cb6c0cafc 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1853,6 +1853,11 @@ nl802154_dump_llsec_devkey(struct sk_buff *skb, struct netlink_callback *cb) if (err) return err; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { + err = skb->len; + goto out_err; + } + if (!wpan_dev->netdev) { err = -EINVAL; goto out_err; From patchwork Mon Apr 5 00:30:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182499 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 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 38DA1C43470 for ; Mon, 5 Apr 2021 00:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AEE06136A for ; Mon, 5 Apr 2021 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbhDEAbd (ORCPT ); Sun, 4 Apr 2021 20:31:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50808 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbhDEAbT (ORCPT ); Sun, 4 Apr 2021 20:31:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582673; 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=bWUdLJo2cMQDk+q38cVffltQu3HvJ8GvQwA1ZuTeNbs=; b=Ki9BEXMkeCL4X63PvnhUVdXbCI9j32pIm11CnqZEZ2Dt0z21fWt1YWWMIeGjpq4eZUd/cf JnIo3m5G1KszlwomNna01tuVOCwj9fVXx80NFF3UJovvplbXiXIAuui9JUNly3oTghHZM7 E8317blH6tEG4IeJJMm04juTgRuhhxk= 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-65-EkdbIPmgPYanDtH-MiKc2Q-1; Sun, 04 Apr 2021 20:31:11 -0400 X-MC-Unique: EkdbIPmgPYanDtH-MiKc2Q-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 8222B81744F; Mon, 5 Apr 2021 00:31:10 +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 0E5D537DD; Mon, 5 Apr 2021 00:31:09 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 10/15] net: ieee802154: forbid monitor for add llsec devkey Date: Sun, 4 Apr 2021 20:30:49 -0400 Message-Id: <20210405003054.256017-11-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 add llsec devkey for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 6f9cb6c0cafc..c3f9bff7a557 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1915,6 +1915,9 @@ static int nl802154_add_llsec_devkey(struct sk_buff *skb, struct genl_info *info struct ieee802154_llsec_device_key key; __le64 extended_addr; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack) < 0) return -EINVAL; From patchwork Mon Apr 5 00:30:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182501 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 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 29907C433B4 for ; Mon, 5 Apr 2021 00:31:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2B656136A for ; Mon, 5 Apr 2021 00:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbhDEAbe (ORCPT ); Sun, 4 Apr 2021 20:31:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37308 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbhDEAbV (ORCPT ); Sun, 4 Apr 2021 20:31:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582675; 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=TFv7cz9MPusINhDBE3YU+ou8WqCyc1JOsjs+Pyb7JmY=; b=X0YgSKrCcwQO5aRin+FiNL6+rTjr38Cc70YzLItqQNlzHsO9x0r13mbm8dPGBOPVIvjz+s GcYiLUvt0QI3YFjDF3gABT5ZIlB7TSTy3sjbSTqTzS85tZFjwUiPcNoW71DlVNBAN+Frso omPzWOiSW6HuKYmVpc5W87vMFvrJBQo= 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-566-6qe8tAtaOsuSN8vAq-kB9w-1; Sun, 04 Apr 2021 20:31:12 -0400 X-MC-Unique: 6qe8tAtaOsuSN8vAq-kB9w-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 2B678107ACCA; Mon, 5 Apr 2021 00:31:11 +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 AB2C037DD; Mon, 5 Apr 2021 00:31:10 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 11/15] net: ieee802154: forbid monitor for del llsec devkey Date: Sun, 4 Apr 2021 20:30:50 -0400 Message-Id: <20210405003054.256017-12-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 devkey for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 c3f9bff7a557..88735f03b73e 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -1949,6 +1949,9 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info struct ieee802154_llsec_device_key key; __le64 extended_addr; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + return -EOPNOTSUPP; + if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] || nla_parse_nested_deprecated(attrs, NL802154_DEVKEY_ATTR_MAX, info->attrs[NL802154_ATTR_SEC_DEVKEY], nl802154_devkey_policy, info->extack)) return -EINVAL; From patchwork Mon Apr 5 00:30:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182497 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 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 B9409C43460 for ; Mon, 5 Apr 2021 00:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93DD861393 for ; Mon, 5 Apr 2021 00:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbhDEAbd (ORCPT ); Sun, 4 Apr 2021 20:31:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51589 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbhDEAbU (ORCPT ); Sun, 4 Apr 2021 20:31:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582674; 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=npK8BY/FGAVwaaC/lhkdfNVd3nL+DQGeL0KtFJC0rq8=; b=XLuV256c+kLv5grn1zgBHxchAsKcYdcG5IBLYGs+g+rvtkOgC/uSX9GFxCvHwtkh/yDulw ey5OKL4srT4hT5YJITNoz2tgyPCkk3X4fLcc1V2MhEv3jP/hJPTBLdWqCQFW235gOW/dzz 4jtDZU8APOv3NNXEo97gOXb71hDnnsM= 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-195-Q6kfSqflPiW_5WYs9xaNww-1; Sun, 04 Apr 2021 20:31:12 -0400 X-MC-Unique: Q6kfSqflPiW_5WYs9xaNww-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 C880E107ACCD; Mon, 5 Apr 2021 00:31:11 +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 549DC37DD; Mon, 5 Apr 2021 00:31:11 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 12/15] net: ieee802154: stop dump llsec seclevels for monitors Date: Sun, 4 Apr 2021 20:30:51 -0400 Message-Id: <20210405003054.256017-13-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 stops dumping llsec seclevels for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index 88735f03b73e..9158b095ccf9 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -2026,6 +2026,11 @@ nl802154_dump_llsec_seclevel(struct sk_buff *skb, struct netlink_callback *cb) if (err) return err; + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) { + err = skb->len; + goto out_err; + } + if (!wpan_dev->netdev) { err = -EINVAL; goto out_err; From patchwork Mon Apr 5 00:30:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182505 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 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 12397C43460 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 E2E1E6136A for ; Mon, 5 Apr 2021 00:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbhDEAbi (ORCPT ); Sun, 4 Apr 2021 20:31:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33321 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbhDEAbW (ORCPT ); Sun, 4 Apr 2021 20:31:22 -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=jgpUIGLISFeh7eSs+6nGRaPvORhnNP9d/VkxZsbMKD4=; b=Z+AynegZg2Uay8ZWoIdbr/GVdPTjlxzKYH3ChiYFC+H0TFjuPzHoykIxGaDqR227vub7v3 W2LIyRczoEIoBwSxnK5XF5bu4kmmvcwoUvePP5Syi+l7UdCgYfsl6gp0/21zU4srq9kqed 1m22vmqowZ+NxdVsERM4iRq905sCJEU= 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-169-gSK3XDk4Omu9t4v9iDeDdA-1; Sun, 04 Apr 2021 20:31:13 -0400 X-MC-Unique: gSK3XDk4Omu9t4v9iDeDdA-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 724F210866A0; Mon, 5 Apr 2021 00:31:12 +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 F143037DD; Mon, 5 Apr 2021 00:31:11 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 13/15] net: ieee802154: forbid monitor for add llsec seclevel Date: Sun, 4 Apr 2021 20:30:52 -0400 Message-Id: <20210405003054.256017-14-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 add llsec seclevel for monitor interfaces which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. 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 9158b095ccf9..28427ce52a9b 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -2115,6 +2115,9 @@ static int nl802154_add_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 (llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], &sl) < 0) return -EINVAL; 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) From patchwork Mon Apr 5 00:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12182503 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 0D96BC433B4 for ; Mon, 5 Apr 2021 00:31:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF1996136A for ; Mon, 5 Apr 2021 00:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231807AbhDEAbf (ORCPT ); Sun, 4 Apr 2021 20:31:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20276 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231776AbhDEAbW (ORCPT ); Sun, 4 Apr 2021 20:31:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617582676; 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=kMOqq1/PktQRCTljm11AKdNIYxKwGhsiCRjW2bJJRN4=; b=STSUFvRezH4z0UpSsPiEYqkIM4sM1NgM9eeDcFFzHoT+m3B+TiaH8k7PpDNAybJhRrQ7AG evOVLEN+1gSr39pAhfS1IDxT7PQSs9iVqQyNPrIyDzatE0CyrYgyxD5gfX3XbutbATW4ln 6/0kgMj8VP0g/ZgdHUMPjEMXU+L5Q5w= 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-239-l6dR-wIpMlSi_WFlUE0G_A-1; Sun, 04 Apr 2021 20:31:14 -0400 X-MC-Unique: l6dR-wIpMlSi_WFlUE0G_A-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 BA5CF881278; 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 4622D2B1AD; Mon, 5 Apr 2021 00:31:13 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND wpan 15/15] net: ieee802154: stop dump llsec params for monitors Date: Sun, 4 Apr 2021 20:30:54 -0400 Message-Id: <20210405003054.256017-16-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 stops dumping llsec params for monitors which we don't support yet. Otherwise we will access llsec mib which isn't initialized for monitors. Reported-by: syzbot+cde43a581a8e5f317bc2@syzkaller.appspotmail.com Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index effc4c1a4780..05f6bd89a7dd 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -820,8 +820,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, goto nla_put_failure; #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL + if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) + goto out; + if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) goto nla_put_failure; + +out: #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ genlmsg_end(msg, hdr);