Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1305195ybt; Thu, 25 Jun 2020 02:53:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpYzhVLVVNc90g0bFbdQ8JyVgG5qPvyjwg9lNBfMCE7QFOPtJfcXaAK9iNC3XHzSl6FTCr X-Received: by 2002:a17:906:4c42:: with SMTP id d2mr29943078ejw.474.1593078825051; Thu, 25 Jun 2020 02:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593078825; cv=none; d=google.com; s=arc-20160816; b=vdC5aRJIWaY64ZTKarrlEAJzBzP1spOrj1w1/yeqZSz0R+R1A0A1UaX5YpGW/Q0Q4V nN5Mm/nCKzy+2i7sH4n5NetLBw03lfLO8LB8ts+CYDy5ipoXHBFgNoCfGDbFI9bZB46a 0pvqMYamxDSmMTGn4EXCwK2ShqpUvIrTqpuhsRbu8wTZ2yYUaLDUQfSufMp7EViQ8iQr ehCqJTvuaw7BE4TY64Xf4Im9cmFfVpDtSZww183Loaca43Itdq+lPztavXLppa3DRsBw IzMaPMQA1Up4opfvN1pAkKpy3urnDHNCcF2s0/3Wu8QfstJHjVRCgMr9vZYCprHQIViA 1OqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=WlGJbWoVnzGCV6T6hzacOTvrw5CTpQiE/LcumX0ceuI=; b=VKyAafYR9WAhmCdcvlFLna/geYN49dg4BUAcI03Vo4Fryjwhqh6UtPeJYt4IWwNk1h gkMmWU5DV3hKtrvZu0j7/NkKoCBe+EmCGr2v703HNYRxvf7j+wrHDqjcIzayw5mEEUvm pXK22iqFz+l3IjymCAsR6BBglzzUqxslwJ0vojaZa/SEPerY5+cdH5K4OYoPsxZyFEE5 ZgzsliI/qZ245eHoH9rM3mDR2D1sIBdYOj5AsrTWs/+Y07itxr/coN41mdwdkw52PgZp uy+ufUDYWnSF6uHKds+Yf0PzDVfdow8gM114h/phbLMiGX97bh4fO8OqjNHedkvitNVG ngsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw19si9418139ejb.752.2020.06.25.02.53.20; Thu, 25 Jun 2020 02:53:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389917AbgFYJH6 (ORCPT + 99 others); Thu, 25 Jun 2020 05:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbgFYJH6 (ORCPT ); Thu, 25 Jun 2020 05:07:58 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6ACBC061573 for ; Thu, 25 Jun 2020 02:07:57 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1joNrP-00BmxG-VU; Thu, 25 Jun 2020 11:07:56 +0200 Message-ID: <426ce6f8a8dd65f545b4cc094c4ad7f461549934.camel@sipsolutions.net> Subject: Re: [PATCH v3 2/2] mac80211: allow rx of mesh eapol frames with default rx key From: Johannes Berg To: Markus Theil Cc: linux-wireless@vger.kernel.org, kernel test robot Date: Thu, 25 Jun 2020 11:07:46 +0200 In-Reply-To: <20200617082637.22670-3-markus.theil@tu-ilmenau.de> References: <20200617082637.22670-1-markus.theil@tu-ilmenau.de> <20200617082637.22670-3-markus.theil@tu-ilmenau.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > + /* check mesh EAPOL frames first */ > + if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) && ieee80211_is_data(fc))) { > + struct ieee80211s_hdr *mesh_hdr; > + u16 hdr_len = ieee80211_hdrlen(fc); > + u16 ethertype_offset; > + __be16 ethertype; > + > + /* make sure fixed part of mesh header is there, also checks skb len */ > + if (!pskb_may_pull(rx->skb, hdr_len + 6)) > + goto drop_check; > + > + mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len); > + ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) > + + sizeof(rfc1042_header); > + if (!pskb_may_pull(rx->skb, ethertype_offset + sizeof(ethertype)) || > + !ether_addr_equal(hdr->addr1, rx->sdata->vif.addr)) might be nicer to check the address first, pskb_may_pull() is potentially more expensive, and you should be able to check the header address already before even the first pskb_may_pull() here since it's in the normal header. But I don't understand the second pskb_may_pull() anyway, because you use skb_copy_bits() below? > + skb_copy_bits(rx->skb, ethertype_offset, ðertype, 2); > + if (ethertype == rx->sdata->control_port_protocol) > + goto pass_frame; can return 0 here immediately and save the label. johannes