Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6048525rdb; Mon, 18 Sep 2023 02:25:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIc9fQAIR5zV5hkwgpcZ5KwbfAwReUM0eEhSmLqsmItWQA0qZjrWCRotpG7qDj6mxM8JOU X-Received: by 2002:a17:902:ec8a:b0:1c3:64f9:45ad with SMTP id x10-20020a170902ec8a00b001c364f945admr8166361plg.48.1695029101299; Mon, 18 Sep 2023 02:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695029101; cv=none; d=google.com; s=arc-20160816; b=kiOzd2+AWXfa8AsGk8ikQ486G7Z4hrbWSkCbDMlPGKELVnTCK0EQRYw6GLUlCwAG+3 fmpYYLeYcbWWN7Pnj8nWyezLLsUZWCweOrYesq0JOez+Vr+E7WF5aOqR9twAQK7zVjxp JM/vXoTM+cI/2+yH/GTfU5XuAE+RJTYAn8AmtxtdUmoQXxBeC9G6yv2uucElc3zc4SgS ooS5I5YHMCCYuH3CfwVY7Rbjy1O27gv5e2rcs1CYdUsZpaL8/PTawCVYAUVgj/QFVrP3 YvHOfWSpydPzFVg/ZjU+4IWORFSNmr/2HWrEa2vZkGWaTxw86MBU83CTv9qg3k/0HL6t CP8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BGqLnfLS16BMC5Edk6K47RqEUmOdv7ff2FeIy28NY94=; fh=Zwx0XYMrQLLCsoInUvGMZ2A85uEN2o65zNfOZP2npC4=; b=oATnn/5qRcvfypCRJt7FZgj7GYHA6BVZOKlsLaIWW56/cOz1pQbiF/ElF/iVEi+U++ 44oNXzpIl/OnMCI84XzMccTtQcOsuH1ee3ZhdOhVrwUWkNkaw4TmlIsfno7ZZ9McLNil tqclotiaiYM97RAoXpGeXMzMSiqSDu151EpiZRr4aqKtrqz8Z0VMJBloEbVfB54pMmMJ vuWOAHLz896m0b5XuchddhbtEV5bxhjreQYhHIl0vyr2XLz/awPGs/8j3yVUwNQdHRn2 nXFug4cNVbowHplg6ZOIneAvvXC81ygMsiEL89pnv+A8NJvPPAnFxzP99rGlXB1BQSlJ o29A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N0eVana+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y15-20020a17090322cf00b001c589ba4a04si205499plg.24.2023.09.18.02.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 02:25:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N0eVana+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2C5AB807C74D; Mon, 18 Sep 2023 00:53:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238554AbjIRHw0 (ORCPT + 99 others); Mon, 18 Sep 2023 03:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240607AbjIRHwW (ORCPT ); Mon, 18 Sep 2023 03:52:22 -0400 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B60C3AB2 for ; Mon, 18 Sep 2023 00:50:52 -0700 (PDT) Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5733710eecaso2556930eaf.1 for ; Mon, 18 Sep 2023 00:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695023448; x=1695628248; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BGqLnfLS16BMC5Edk6K47RqEUmOdv7ff2FeIy28NY94=; b=N0eVana+QLdnghT5op/ir1CiGuZp5zFrkUFF/DwrQOKLWPeIQOE6sl7AQQCqYWiNJw HexN5ZuyYEU4g0OH5ldw+jHiAbt4uCiHwzv5BFck0OAMXOGKTN2wUHdkyzk9wDc8KUFg bI8a0yzLHquanpG5fPBcQjAQkR4KjlwMEgfYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695023448; x=1695628248; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BGqLnfLS16BMC5Edk6K47RqEUmOdv7ff2FeIy28NY94=; b=U4vHi7Nai3j0J3hvQDeZGIrIKNCGTNV4pllHuMSIm0v5bQfRLj0QgHEOavKolaPP87 bwVkoEt5bTo+Uuz7EQYyzH57EiA3CiFdLXid0Tk8CjOlY7FgBeitMtDPO8M4XI06cSkV jy2/3gv8dU6fUZeOoVGJ8BkH6wh+gZBv2u6zOEBIwp+TdgL0/HRiPvnH5c6yU6TLLs7b V6nqpbk5dImgIOkfxXmlXC9ZEuCik85Q6xYDUo/DZ5NVFv1w6I0MrUKCSpzb3GFlqhfw XYyuuk/fWFVCNsEuwfEu+RH2S3JcYs7Y05jZmMvN4EyBWSkn8+CsOLoG8MMrXsXQ9SXT O8MQ== X-Gm-Message-State: AOJu0YxxI8HFu8kJ6Gg2zjM/caHwBPuxWfZmSnagVZh44pJexKF6+OmA RJwAuUD+hDC20MVwGkgiI+6tmRz866X/o9k2tPzO+w== X-Received: by 2002:a4a:d208:0:b0:571:aceb:26d2 with SMTP id c8-20020a4ad208000000b00571aceb26d2mr8459102oos.3.1695023448533; Mon, 18 Sep 2023 00:50:48 -0700 (PDT) MIME-Version: 1.0 References: <20230908104308.1546501-1-treapking@chromium.org> In-Reply-To: From: Matthew Wang Date: Mon, 18 Sep 2023 09:50:37 +0200 Message-ID: Subject: Re: [PATCH v3] wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet To: Brian Norris Cc: Pin-yen Lin , linux-wireless@vger.kernel.org, Kalle Valo , Polaris Pi , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 18 Sep 2023 00:53:03 -0700 (PDT) lgtm Reviewed-by: Matthew Wang On Fri, Sep 15, 2023 at 1:38=E2=80=AFAM Brian Norris wrote: > > On Thu, Sep 14, 2023 at 03:09:47PM +0800, Pin-yen Lin wrote: > > On Thu, Sep 14, 2023 at 4:31=E2=80=AFAM Brian Norris wrote: > > > I'd appreciate another review/test from one of the others here > > > (Matthew?), even though I know y'all are already working together. > > I'd still appreciate some comment here. > > > > > - if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, > > > > - sizeof(bridge_tunnel_header))) || > > > > - (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, > > > > - sizeof(rfc1042_header)) && > > > > - ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) !=3D ETH_P_AARP= && > > > > - ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) !=3D ETH_P_IPX)= ) { > > > > + if (sizeof(*rx_pkt_hdr) + rx_pkt_off <=3D skb->len && > > > > > > Are you sure you want this length check to fall back to the non-802.3 > > > codepath? Isn't it an error to look like an 802.3 frame but to be too > > > small? I'd think we want to drop such packets, not process them as-is= . > > > > I did that because I saw other drivers (e.g., [1], [2]) use similar > > approaches, and I assumed that the rest of the pipeline will > > eventually drop it if the packet cannot be recognized. But, yes, we > > can just drop the packet here if it doesn't look good. > > > > [1]: https://elixir.bootlin.com/linux/latest/source/drivers/net/wireles= s/intersil/hostap/hostap_80211_rx.c#L1035 > > [2]: https://elixir.bootlin.com/linux/latest/source/drivers/net/wireles= s/intel/ipw2x00/libipw_rx.c#L735 > > Hmm, I suppose. I'm frankly not sure how exactly all upper layers handle > this, but at least in a non-raw mode, we'll drop them. (We might be > delivering awfully weird packets to tcpdump though, but this is already > a weird situation, if it's such a weird-looking packet.) > > > > If I'm correct, then this check should move inside the 'if' branch of > > > this if/else. > > > > We can't simply move the check inside the if branch because the > > condition also checks rx_pkt_hdr->rfc1042_hdr.snap_type. Though, of > > course, it is doable by adding another `if` conditions. > > Right. > > I guess this is probably OK as-is: > > Acked-by: Brian Norris