From patchwork Sun Feb 28 15:18:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108261 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=-16.0 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 E6953C43381 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EDCA64D5D for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbhB1PT5 (ORCPT ); Sun, 28 Feb 2021 10:19:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60666 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbhB1PTy (ORCPT ); Sun, 28 Feb 2021 10:19:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525508; 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=oBgnfLo+d/dBvpawLqs1HKruHJv8Tx0bnqG3j9bT2vE=; b=Q0b0syh9QnWwaWvnCVPqftFcShHJ5JYJ37qppyWpK6PXXFbTP32uI87BoTm1XKDCa33HcG +yS1gWRdgmi4o3Hhyn9b8/ir+HtKlzCGKjerqPMz3FhI2kEd2oRacB+WmEn9Q7wo0dpWNC CzLL+Jog66SwAZEyME/1LJJu5zMlXyY= 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-315-IUULfvWeOu67abUDtmYARA-1; Sun, 28 Feb 2021 10:18:23 -0500 X-MC-Unique: IUULfvWeOu67abUDtmYARA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C719E1936B61; Sun, 28 Feb 2021 15:18:22 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 628AB5C1D5; Sun, 28 Feb 2021 15:18:21 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 01/17] net: ieee802154: make shift exponent unsigned Date: Sun, 28 Feb 2021 10:18:01 -0500 Message-Id: <20210228151817.95700-2-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org This patch changes the iftype type variable to unsigned that it can never be reach a negative value. Reported-by: syzbot+7bf7b22759195c9a21e9@syzkaller.appspotmail.com Signed-off-by: Alexander Aring --- net/ieee802154/nl802154.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index e9e4652cd592..3ee09f6d13b7 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c @@ -898,8 +898,8 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info) static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info) { struct cfg802154_registered_device *rdev = info->user_ptr[0]; - enum nl802154_iftype type = NL802154_IFTYPE_UNSPEC; __le64 extended_addr = cpu_to_le64(0x0000000000000000ULL); + u32 type = NL802154_IFTYPE_UNSPEC; /* TODO avoid failing a new interface * creation due to pending removal? From patchwork Sun Feb 28 15:18:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108259 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=-16.0 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 791D7C433E0 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3117A64D5D for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbhB1PTz (ORCPT ); Sun, 28 Feb 2021 10:19:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42898 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbhB1PTx (ORCPT ); Sun, 28 Feb 2021 10:19:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525506; 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=FzPy8rjCfE+aeIPnfY5KvJTuaibGNzhMbRWIvII9Bk0=; b=E4Q+8bZEEkt4mrAT1MpWAEi/aSq3it/lEK9fCqEYGQcEnB1WyzKxys/81b7LgfbVLg5oj1 buQFHD2i2N1DRTd6kcLHUjWrpLMu9TXH2j2h4pUQNsQAziMTaXs7SqS34WFHNUdGUpc4m1 XSX1dS89th3nd6LgMdOPM3PeE5OAmqk= 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-499-mcjIwLwGNs6oWT9VocDrWQ-1; Sun, 28 Feb 2021 10:18:24 -0500 X-MC-Unique: mcjIwLwGNs6oWT9VocDrWQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C8251005501; Sun, 28 Feb 2021 15:18:23 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAF095C1D5; Sun, 28 Feb 2021 15:18:22 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 02/17] net: ieee802154: fix memory leak when deliver monitor skbs Date: Sun, 28 Feb 2021 10:18:02 -0500 Message-Id: <20210228151817.95700-3-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org This patch adds a missing consume_skb() when deliver a skb to upper monitor interfaces of a wpan phy. Reported-by: syzbot+44b651863a17760a893b@syzkaller.appspotmail.com Signed-off-by: Alexander Aring --- net/mac802154/rx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index b8ce84618a55..18abc1f49323 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c @@ -244,6 +244,8 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) sdata->dev->stats.rx_bytes += skb->len; } } + + consume_skb(skb); } void ieee802154_rx(struct ieee802154_local *local, struct sk_buff *skb) From patchwork Sun Feb 28 15:18:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108265 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=-16.0 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 AEB99C433E6 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54E3D64EB3 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbhB1PT4 (ORCPT ); Sun, 28 Feb 2021 10:19:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48901 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbhB1PTx (ORCPT ); Sun, 28 Feb 2021 10:19:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525506; 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=GtcLdlm1Iv1/5mJ7s1Xbu8kLpZIcHwisL8Wo5TnuA84=; b=J1hu8JHr/dzIzB9WqnQNOptmWebLQznmen6CJc+8OzSiLiIgd2DbMfmbyrPBQ8a3RJnlbR XIS0IcHhNsv4f7wvrKM5yAkCoApr+xF7lIFRS/NlfhKR3C2OVBywyNu8MUm9wVUoN52mbq SUKtH3kFx5pRvzPUfQJ3Pvvpgx2Qx+U= 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-16-q_X4dfRjMOW5l1zi2N4jNw-1; Sun, 28 Feb 2021 10:18:25 -0500 X-MC-Unique: q_X4dfRjMOW5l1zi2N4jNw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E799310066EE; Sun, 28 Feb 2021 15:18:23 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8064E5C1D5; Sun, 28 Feb 2021 15:18:23 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 03/17] net: ieee802154: nl-mac: fix check on panid Date: Sun, 28 Feb 2021 10:18:03 -0500 Message-Id: <20210228151817.95700-4-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 Sun Feb 28 15:18:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108263 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=-16.0 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 C18EBC433E9 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7744064EAF for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230449AbhB1PT4 (ORCPT ); Sun, 28 Feb 2021 10:19:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31516 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhB1PTx (ORCPT ); Sun, 28 Feb 2021 10:19:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525508; 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=TycFQJJZAk4wM9Q8t5do6tcFRN5RoTXKW1hvc8NynC0=; b=E7xSKiITKK0yE2goJVwVqBHoVzNoMQSA6F6OiUlNimXEGsZFA62ZcCGw8Zd5MWnF985Ma7 PpF9XpDTCd0of/zKmGCRUgwO41YWgw7G9i8qUcRT5h1EccQqup9+vP4j1Idm/4Sup3lZxT wu8zp6zCiRqCWVc16RBZFtXPPbHKVzM= 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-83--i6qSeXEOhO51JrUXiug0A-1; Sun, 28 Feb 2021 10:18:25 -0500 X-MC-Unique: -i6qSeXEOhO51JrUXiug0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BCDE6D4F0; Sun, 28 Feb 2021 15:18:24 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15C845C1D5; Sun, 28 Feb 2021 15:18:24 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 04/17] net: ieee802154: forbid monitor for set llsec params Date: Sun, 28 Feb 2021 10:18:04 -0500 Message-Id: <20210228151817.95700-5-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 3ee09f6d13b7..67f0dc622bc2 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 Sun Feb 28 15:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108269 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=-16.0 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 43980C4332D for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19E9264D5D for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbhB1PT7 (ORCPT ); Sun, 28 Feb 2021 10:19:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:58104 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbhB1PTy (ORCPT ); Sun, 28 Feb 2021 10:19:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525508; 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=4Q5ng1dnkOvX+hziKJ95/sFrLuRwsL45MJOjmkTNEGg=; b=JTMSdtsssNzRV/0TJ0OXvN6Q6iM7PEBMjKq5S/IKziMM3AjKDTJtJ3vFiKufNI/8/f657i wcHSuTa1R4Bo7+YjPTzXU+NaxASkqSioLkVgb/ZeuFPBPNQERemgc55yAjWIg9CnffB7EQ neZzwmrlQ7DIQygD24nL18Ff2KkO7EI= 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-602-Zm8f1K8-NfGx7AGcSHV8yA-1; Sun, 28 Feb 2021 10:18:26 -0500 X-MC-Unique: Zm8f1K8-NfGx7AGcSHV8yA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10FA36D4E6; Sun, 28 Feb 2021 15:18:25 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F2DF5C1D5; Sun, 28 Feb 2021 15:18:24 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 05/17] net: ieee802154: stop dump llsec keys for monitors Date: Sun, 28 Feb 2021 10:18:05 -0500 Message-Id: <20210228151817.95700-6-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 67f0dc622bc2..f8f1792c3620 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 Sun Feb 28 15:18:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108267 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=-16.0 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 1F28FC4332E for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E88F364EB1 for ; Sun, 28 Feb 2021 15:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbhB1PT6 (ORCPT ); Sun, 28 Feb 2021 10:19:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29129 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhB1PTy (ORCPT ); Sun, 28 Feb 2021 10:19:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525508; 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=yS6bReS91F0YH5h/3hRSaN42p8HIYa8WJaFonTD2cbA=; b=LvpVM8O8O49mFLHaBdnTPd/U9YCO7VeaWlhXMNuulnpY6oE3EZXXvqQNevUM2ul0d+kP+X dVUlSbdwJ3LFrGpHy+RoLF54z3anTG0WwmygYh0/bXD1liLa6I4LyNLTT0RlbHeupUrlgf B2s9qYP26bn6JvT+c+pGEM74UajXyC0= 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-519-oTV0ipMBPSutcTQJot_ZRQ-1; Sun, 28 Feb 2021 10:18:26 -0500 X-MC-Unique: oTV0ipMBPSutcTQJot_ZRQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99E4180197D; Sun, 28 Feb 2021 15:18:25 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 338F75C1D5; Sun, 28 Feb 2021 15:18:25 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 06/17] net: ieee802154: forbid monitor for add llsec key Date: Sun, 28 Feb 2021 10:18:06 -0500 Message-Id: <20210228151817.95700-7-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 f8f1792c3620..3bc71505ad63 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 Sun Feb 28 15:18:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108271 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=-16.0 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 6E4E0C43331 for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A39164EB1 for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbhB1PT7 (ORCPT ); Sun, 28 Feb 2021 10:19:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50101 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbhB1PTz (ORCPT ); Sun, 28 Feb 2021 10:19:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525509; 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=PfwR3W563KI/WfAeC5FqrdKxeIJOriALEtiClZPNrGY=; b=jUEaiKGlXyKsLeL4HvVCce8d4uvFZn33Sp+YL7LleRDgI5jQMA54cHQLXL5yn52S5iN1tx /eGybR7Yj7FhE/NRnwJyCoTy+028EPI8XETQU9eA85ace4OMM8OtlzWAq5+RLLwDaedRBK r5AyKZzat4hAgn2XDu88BUkJFjug5ms= 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-554-oaGzrdeqOP-nIlQM8LKHow-1; Sun, 28 Feb 2021 10:18:27 -0500 X-MC-Unique: oaGzrdeqOP-nIlQM8LKHow-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 44EE6801980; Sun, 28 Feb 2021 15:18:26 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC81E5C1D5; Sun, 28 Feb 2021 15:18:25 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 07/17] net: ieee802154: forbid monitor for del llsec key Date: Sun, 28 Feb 2021 10:18:07 -0500 Message-Id: <20210228151817.95700-8-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 3bc71505ad63..fdea9c20cd8e 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 Sun Feb 28 15:18:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108273 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=-16.0 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 87622C43332 for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 559A664EAF for ; Sun, 28 Feb 2021 15:20:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbhB1PUA (ORCPT ); Sun, 28 Feb 2021 10:20:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55596 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbhB1PTz (ORCPT ); Sun, 28 Feb 2021 10:19:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525509; 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=pTdkHNEj/iPhhGQlg43N+RrbkDwtfB7kCayudPusiY8=; b=TCTa/jblrrTXPSDMdfe6zV/OwTQs2IlHIPoDhF9dkpXJQWXPvu7ZVSUsGnLv9v+C1nUAWi j+ul/L5qYRn6/ajv+AeoVRpnfOdvYeGBIDyAlN9pSBC8rlbKI7642kq4mIPK31T+U4Yjdu LmJ85Ck0iuyboKGaf1MJkhE1iYlN8eQ= 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-174-pc2nkC8OOwKVG-Vqytv0oA-1; Sun, 28 Feb 2021 10:18:27 -0500 X-MC-Unique: pc2nkC8OOwKVG-Vqytv0oA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7AD0107ACF5; Sun, 28 Feb 2021 15:18:26 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 515F45C1D5; Sun, 28 Feb 2021 15:18:26 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 08/17] net: ieee802154: stop dump llsec devs for monitors Date: Sun, 28 Feb 2021 10:18:08 -0500 Message-Id: <20210228151817.95700-9-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 fdea9c20cd8e..7f728d85e9b6 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 Sun Feb 28 15:18:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108279 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=-16.0 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 A9A1BC433E9 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E69E64EAF for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbhB1PUT (ORCPT ); Sun, 28 Feb 2021 10:20:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34998 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbhB1PT6 (ORCPT ); Sun, 28 Feb 2021 10:19:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525512; 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=qbHjWMdzSnO9u6fOOnNr8/pV6qnRvnT5ATDhbRpeEPc=; b=gi6+BYvwLLVGnhzuNjIUKPmmi4n8Go7QEupKrGaxyR2/KeZuvoi0GQVtF2fbbF31NHUDjH eqxRZuk9nok86Yy2PLraA5izoiXvyVo073doUilXyjpx/gAukAw+CJjDSGJ6BDv2s6oro7 C7ewoPRU6AzHoWzfbylddOSqhKj9f+o= 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-560-tf3H-480MYy1PIjG7Ku5uw-1; Sun, 28 Feb 2021 10:18:28 -0500 X-MC-Unique: tf3H-480MYy1PIjG7Ku5uw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DBD61936B60; Sun, 28 Feb 2021 15:18:27 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBC7C5C1D5; Sun, 28 Feb 2021 15:18:26 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 09/17] net: ieee802154: forbid monitor for add llsec dev Date: Sun, 28 Feb 2021 10:18:09 -0500 Message-Id: <20210228151817.95700-10-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 7f728d85e9b6..c32e55f961c2 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 Sun Feb 28 15:18:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108281 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=-16.0 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 772EFC43381 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4965764EB1 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbhB1PUP (ORCPT ); Sun, 28 Feb 2021 10:20:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50467 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhB1PT5 (ORCPT ); Sun, 28 Feb 2021 10:19:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525511; 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=/N9mjJW3W0eC4wzSlguu9RYpB4AfVEyqkbrMcjAVPcs=; b=GaXMvyiAjy5s0loAjpwVDccLq2xL9BgSp/uv9oAw+cHABUi+H+UyOL/ojf/YVv/1Up1Am5 9UfiKQe29tv+AFgFBSeG5pyEOw/00rqu4y2AQ/M6IU3zS2+r5VZyy35Qibde8M7w57eCZ0 3bTiCzQSFwKma1pYR16Z51vcRgdrXlA= 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-369-RUtnEo6NMPWdhuH0A9qMZQ-1; Sun, 28 Feb 2021 10:18:28 -0500 X-MC-Unique: RUtnEo6NMPWdhuH0A9qMZQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D739B1936B61; Sun, 28 Feb 2021 15:18:27 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 714885C1D5; Sun, 28 Feb 2021 15:18:27 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 10/17] net: ieee802154: forbid monitor for del llsec dev Date: Sun, 28 Feb 2021 10:18:10 -0500 Message-Id: <20210228151817.95700-11-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 c32e55f961c2..46faf451f413 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 Sun Feb 28 15:18:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108275 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=-16.0 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 1E9BAC433DB for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E859364EAF for ; Sun, 28 Feb 2021 15:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbhB1PUM (ORCPT ); Sun, 28 Feb 2021 10:20:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21984 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbhB1PT5 (ORCPT ); Sun, 28 Feb 2021 10:19:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525511; 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=AYUFQOH69SnWW6q2HidGRNI/Wyu1Y7+78kfdmbYl2HY=; b=Lylaan9xfsSYNZD3+9TprOcXpPRBLU7UsW2Je8gQu1o56erq5MJbl5semcmBegb4i5r3d7 aSmBawiVoIcYTBCBIP+kD0DZ0UKVeHLG/dzatpJEKsgChRVyjjDlIr2hJxwKBKTz7DU0h8 0UdQ25HFNR6HG2nw2hejJZ5G8KzLGYQ= 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-567-5ok3pgi8Pk6P2yfnP7PZmw-1; Sun, 28 Feb 2021 10:18:29 -0500 X-MC-Unique: 5ok3pgi8Pk6P2yfnP7PZmw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C8A3107ACC7; Sun, 28 Feb 2021 15:18:28 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067AB5C1D5; Sun, 28 Feb 2021 15:18:27 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 11/17] net: ieee802154: stop dump llsec devkeys for monitors Date: Sun, 28 Feb 2021 10:18:11 -0500 Message-Id: <20210228151817.95700-12-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 46faf451f413..43e7b029c444 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 Sun Feb 28 15:18:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108277 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=-16.0 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 410F0C433E0 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09E9964EB1 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbhB1PUO (ORCPT ); Sun, 28 Feb 2021 10:20:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41365 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbhB1PT6 (ORCPT ); Sun, 28 Feb 2021 10:19:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525512; 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=NLX1acInnz3QI0gdqLirblp939RheEQGCpz65KKuohE=; b=FYdWpgzuR+Qcx3tsORdqAfvoc02Z8xQgZ8XWoQtKzp9kuTgyVatd8FBLZ9XFXesZ0lWhju 5NDFwR/EnGfT4awwjgL54Yd2ZLDovIUg4v0QAWaW71ngXje3tkVwhEo/sZ2b0ZDmEKSiTG TjNvLHKIhX5IOzf/B7h5SFwVP8rLRmw= 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-569-5LXbqB1OOSip-4B2swpYBw-1; Sun, 28 Feb 2021 10:18:30 -0500 X-MC-Unique: 5LXbqB1OOSip-4B2swpYBw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 020E7107ACE3; Sun, 28 Feb 2021 15:18:29 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9020C5C1D5; Sun, 28 Feb 2021 15:18:28 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 12/17] net: ieee802154: forbid monitor for add llsec devkey Date: Sun, 28 Feb 2021 10:18:12 -0500 Message-Id: <20210228151817.95700-13-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 43e7b029c444..ecdaff719b08 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 Sun Feb 28 15:18:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108283 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=-16.0 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 CBA46C4332B for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 901C564EB1 for ; Sun, 28 Feb 2021 15:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbhB1PUU (ORCPT ); Sun, 28 Feb 2021 10:20:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41239 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbhB1PT7 (ORCPT ); Sun, 28 Feb 2021 10:19:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525513; 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=m8grdQd20rEAZ4hZ8+9BjQTOGWKKgDiwRwpn51/ihEo=; b=G7nWeZbvEjM2Iwv023GVF7NUSSOzc4kNXI3ynpnENDCEYqz963SQred908oS1qftwhExRW PW5HulYqwjGavbblpCCZpkqv2w/Wb5gSjcoq5+C+5rQsdF4B/VRFVxlHQzxs4W5aUDcejS 9fiGZ6P6swm0Gx0KInsOx/CtAtPR67w= 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-356-ikh2uNh7ONiOWYhVlsKPhg-1; Sun, 28 Feb 2021 10:18:30 -0500 X-MC-Unique: ikh2uNh7ONiOWYhVlsKPhg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B01F96D4E0; Sun, 28 Feb 2021 15:18:29 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 252D95C1D5; Sun, 28 Feb 2021 15:18:29 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 13/17] net: ieee802154: forbid monitor for del llsec devkey Date: Sun, 28 Feb 2021 10:18:13 -0500 Message-Id: <20210228151817.95700-14-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 ecdaff719b08..d0352148e34c 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 Sun Feb 28 15:18:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108285 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=-16.0 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 1876CC4332D for ; Sun, 28 Feb 2021 15:20:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE40F64D5D for ; Sun, 28 Feb 2021 15:20:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbhB1PUY (ORCPT ); Sun, 28 Feb 2021 10:20:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42629 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbhB1PT7 (ORCPT ); Sun, 28 Feb 2021 10:19:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525513; 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=roKbvdchfdha4OXRhxovDmvW8qahWbulZ67jfkOsE40=; b=XkNtCl8kvaC8BSMTk611oj72tcpo8wEXbhryGDfMi0aAQaIRSWZ5ha0XQXBn7X/hFsUbsE 4NQbqtsiKf5ky0eIX7QhBYRemaXGqOz5JmoRHPIieV7fb6DFiYmSqAP2pVSqzgdZbRqYZn M4C/1zLLURuQLfoA45kZG97e4t2qnBc= 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-590-FvIX_5lvN9uQ49P17tkJtQ-1; Sun, 28 Feb 2021 10:18:31 -0500 X-MC-Unique: FvIX_5lvN9uQ49P17tkJtQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 443EF10066EE; Sun, 28 Feb 2021 15:18:30 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id D38A35C1D5; Sun, 28 Feb 2021 15:18:29 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 14/17] net: ieee802154: stop dump llsec seclevels for monitors Date: Sun, 28 Feb 2021 10:18:14 -0500 Message-Id: <20210228151817.95700-15-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 d0352148e34c..95a13a5b75d0 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 Sun Feb 28 15:18:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108287 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=-16.0 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 707C1C433DB for ; Sun, 28 Feb 2021 15:20:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39EDF64D5D for ; Sun, 28 Feb 2021 15:20:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbhB1PU0 (ORCPT ); Sun, 28 Feb 2021 10:20:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54879 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbhB1PUA (ORCPT ); Sun, 28 Feb 2021 10:20:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525514; 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=ZDC89FlNB6A8AriR09kja0Dj2b4LN5vzrIG19Vq9n80=; b=Ew9fFC90zHRfIwKFOyi+ZXQ8RU6lhBu8LPNsyS+snGYtmSU8M6PB6rXq9MpYRmzOyIPjtL SmrUA3DoQRviG+mg/+6TSfCuliuPJ+VpA7o4DiDniihxgoGTmiOopm1+0gwBeyZ3hp4XyE ewSxX23Pogb5ifqf1Msfd3YXLbbFkew= 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-591-RfMR9lbCOfunpmJrsy3YZg-1; Sun, 28 Feb 2021 10:18:31 -0500 X-MC-Unique: RfMR9lbCOfunpmJrsy3YZg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE7AF10066EF; Sun, 28 Feb 2021 15:18:30 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 682565C1D5; Sun, 28 Feb 2021 15:18:30 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 15/17] net: ieee802154: forbid monitor for add llsec seclevel Date: Sun, 28 Feb 2021 10:18:15 -0500 Message-Id: <20210228151817.95700-16-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 95a13a5b75d0..e5181de4a77a 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 Sun Feb 28 15:18:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108291 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=-16.0 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 7947FC433E9 for ; Sun, 28 Feb 2021 15:20:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D86764D5D for ; Sun, 28 Feb 2021 15:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbhB1PUd (ORCPT ); Sun, 28 Feb 2021 10:20:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22558 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbhB1PUC (ORCPT ); Sun, 28 Feb 2021 10:20:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525516; 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=PeSpDSkiOIRLibPx5IY1ERbxboVDlbwir0mbFIxNQ4c=; b=SGg4rYYhGHoscfg+UNAoy4XPT9Ndd6lAf8WHE6AFrbyScqKETrf46Ies3uix7fpsnzHQ9Z /n2R9YR/J+mtjUq2tERGoNbc6nPEyWprBO1uNfoepjyfV46VRm105AC5gob1RPQUJAbmQ6 CgMuwf5hhaRfCJa7NImQ+h0OIh97RwQ= 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-597-YTShLGthP2OJqeAxgZcPQQ-1; Sun, 28 Feb 2021 10:18:32 -0500 X-MC-Unique: YTShLGthP2OJqeAxgZcPQQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 639D110066F0; Sun, 28 Feb 2021 15:18:31 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2AC85C1D5; Sun, 28 Feb 2021 15:18:30 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 16/17] net: ieee802154: forbid monitor for del llsec seclevel Date: Sun, 28 Feb 2021 10:18:16 -0500 Message-Id: <20210228151817.95700-17-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 e5181de4a77a..576e418cf5aa 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 Sun Feb 28 15:18:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 12108289 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=-16.0 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 7C8BFC433E6 for ; Sun, 28 Feb 2021 15:20:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ABBD64D5D for ; Sun, 28 Feb 2021 15:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbhB1PUb (ORCPT ); Sun, 28 Feb 2021 10:20:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34207 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhB1PUB (ORCPT ); Sun, 28 Feb 2021 10:20:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614525515; 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=2Bjh3DgtlYNb9J1LAYIfqCcgtyxWNouNwOMSlbNTffo=; b=OvC95dhDjQMhXSpf5Omwss4eu0TJssY53urd9+XpMh814WgvtPYJDb3Ul2i++lDlJu6A0g 1K77NhEqo+L7lJ1S47JipNkd0CJ52szdduS+tu87NvsyCO+jiT1BFalHGzX9kJpczBVDb7 0rLooruXz47vNOoYKQNF7Sq7KJvJtBY= 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-264-xrVApX3ZPwmrq5exfDTYpA-1; Sun, 28 Feb 2021 10:18:33 -0500 X-MC-Unique: xrVApX3ZPwmrq5exfDTYpA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED1948030C2; Sun, 28 Feb 2021 15:18:31 +0000 (UTC) Received: from carbon.redhat.com (ovpn-112-225.rdu2.redhat.com [10.10.112.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E7B5C1D5; Sun, 28 Feb 2021 15:18:31 +0000 (UTC) From: Alexander Aring To: stefan@datenfreihafen.org Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH wpan 17/17] net: ieee802154: stop dump llsec params for monitors Date: Sun, 28 Feb 2021 10:18:17 -0500 Message-Id: <20210228151817.95700-18-aahringo@redhat.com> In-Reply-To: <20210228151817.95700-1-aahringo@redhat.com> References: <20210228151817.95700-1-aahringo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 576e418cf5aa..ca8e17a81a4f 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);