Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp525604rwi; Thu, 20 Oct 2022 01:43:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gO2Alk9WAEGlrhgS9uWPirWbA+cXDD8pK+GjYAPBY3gm8Abkb6Cw8PjVHaPJxz8STBS08 X-Received: by 2002:a17:907:7208:b0:78e:176e:e0c6 with SMTP id dr8-20020a170907720800b0078e176ee0c6mr10118231ejc.594.1666255383948; Thu, 20 Oct 2022 01:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666255383; cv=none; d=google.com; s=arc-20160816; b=dmp3l2C16OD+QgNn4adtHOII7+IzBS+SnxHqXELJP+ipl0LHPZ1a1d9afvQ83kDqEG xpql98xtxQOAsYMsNFr1sUTq8Gk1riihLZiFMas5/j4uAEAqAksWBk6tfA/zWqdTaTsB Rvw656N3Nu5iQ+QnUwUx9F/Na79vIeT9LwLn9/e49wh5Fa/vVPBWI3lNDVYyXsK/Yeb8 JPTrkM74ToZGOTacrbkTOmNA4WkG5nZu9tSbbZBOxvfL7EWHyIwhJ3x+N6+3LN6Fb17v R9MXYGNiDfWRfJN2o9uJO5CzpE6p5npCua+ucSyImlfSZWEdQ1LZzu61sfEMz8Ohxvlf 36kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=g/AThwvADeBAp+alg9WOruwZf/m3b3fMO0/6Sqpu80k=; b=SOlV2dWVYQqVr4G5+wjfwzsr5ankCSzbYb7RmXa2Zm/1ANYA30/P+XhX7ruofGPz9M TkQqbwYkIaHKexQezkJRiQzQOu84qlapJfWo+OSgxo5glNoDe7vHaKL8DrJQlMT6eQC/ EV0Wnj3o+K0T3y+wfq6LVjikxTk2MhqvUi1HJzWwaH7ra3Bv3xFd80erZY2afWk+bFFF 3nYW9NbBO3yy1lZwAgrdgPQVpSsG+EMslP+fkxbLUGD/SuzH476mUsg1Vb+yI1HZNRgR mLjIvVxuqVbxHSS2gS9ZfZVbSmj1BduiFDSUvJch23EQnvyvFgruDfhW2vOb0qof1gbF nrnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KnwDVBaB; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji6-20020a170907980600b0073d6ad8251asi17852741ejc.812.2022.10.20.01.42.46; Thu, 20 Oct 2022 01:43:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KnwDVBaB; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230129AbiJTIlo (ORCPT + 64 others); Thu, 20 Oct 2022 04:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiJTIlm (ORCPT ); Thu, 20 Oct 2022 04:41:42 -0400 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A2C615B12B for ; Thu, 20 Oct 2022 01:41:37 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id l28so13275937qtv.4 for ; Thu, 20 Oct 2022 01:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=g/AThwvADeBAp+alg9WOruwZf/m3b3fMO0/6Sqpu80k=; b=KnwDVBaBid5r6hkQHqjieUG+9VC//zO5Y0c2Mj2VocAfax8/mD6RnKtsvgyQhTlKQf YyPMlJjohuuWeXsLnSsN2Wo79Kb/XAsMh+Dq9l7+C5UPZhKifsUxA4CN6lUUIDRO+GH8 QrNhNiZjU9zl8Qs/tBJYwBO2P1CsocdHw7KHt9rS2ZzYK0V/C6Y/IRg875JYp2OErryN Sisno9oGmVebXqKCPZshoGUVXKswarSAbhnb6g9dsqqou2Kg4u/g/STxQnizqejjyNAv rlq1VDuVijIfRDzW803H0jpIKrAtyQTYx94SQKeHLm+8QUsdSlNsNTjRGNC6zVSU74mI IaEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g/AThwvADeBAp+alg9WOruwZf/m3b3fMO0/6Sqpu80k=; b=AHdzydNbNa5iBzElhO7sZ6PLBEh8LRbAB9dcV+yzwE5t+kuYSMdaXp40qD7wxRVljP lrZJU1SGoNrjEB4xMipTESzxQuRb++BaFO7o3oCQBExnI1/0hHulEzM5K2FhXGNWsj1v dDcidDDitv6ZRBeHOvFUhZvMWEADhaK78IObc+rJVPtLEfsIGT0euXxHwryUHz9TpyPk hQdh6a5N4PFFqeQEAAWf30H7vuq4qjFiEZto0zoE6zQOsAMpm5aBH5Kktz92Uo5xUQJZ B1BXNlEJJbMkAnF9TOqFbWxF5LIcGBNShZs74wm4/ewFknnJgAvwhn3qnvcL7zAwdsAX e+9Q== X-Gm-Message-State: ACrzQf0T1xLQF0yEFLLmtK7RoXP9MhjBXgr9/xehYFMHAtUn3RBXns8Q rgSSlna/wnqosPFOxus4hzgQZ8Kdoa+ZRL2T X-Received: by 2002:ac8:5708:0:b0:39c:e967:bc05 with SMTP id 8-20020ac85708000000b0039ce967bc05mr9885333qtw.493.1666255296195; Thu, 20 Oct 2022 01:41:36 -0700 (PDT) Received: from [10.176.68.61] ([192.19.148.250]) by smtp.gmail.com with ESMTPSA id f3-20020a05620a408300b006ce515196a7sm6983954qko.8.2022.10.20.01.41.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Oct 2022 01:41:35 -0700 (PDT) Message-ID: Date: Thu, 20 Oct 2022 10:41:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH] brcmfmac: Fixes potential buffer overflow in 'brcmf_fweh_event_worker' Content-Language: en-US From: Arend Van Spriel To: Dokyung Song , linux-wireless@vger.kernel.org Cc: Jisoo Jang , Minsuk Kang References: <20221020014907.GA338234@laguna> <649de84e-6f9a-5c6b-9a94-a7c6462abd1f@gmail.com> In-Reply-To: <649de84e-6f9a-5c6b-9a94-a7c6462abd1f@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 10/20/2022 10:39 AM, Arend Van Spriel wrote: >> -        else >> +        } else { >> +            if (emsg.bsscfgidx >= BRCMF_MAX_IFS) { >> +                bphy_err(drvr, "invalid bsscfg index: %u\n", >> emsg.bsscfgidx); >> +                goto event_free; >> +            } > > probably better to do the validation before any other handling. So right > after converting the event message at line 245 > > https://elixir.bootlin.com/linux/latest/source/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c#L245 Actually, if we ignore the event message we can avoid the whole conversion as well doing the validation before the convert. Regards, Arend