From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E090C4332F for ; Thu, 14 Dec 2023 07:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443337AbjLNHfd (ORCPT ); Thu, 14 Dec 2023 02:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234348AbjLNHfc (ORCPT ); Thu, 14 Dec 2023 02:35:32 -0500 Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A116F95; Wed, 13 Dec 2023 23:35:36 -0800 (PST) Received: from francesco-nb.int.toradex.com (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 4FD39206E7; Thu, 14 Dec 2023 08:35:31 +0100 (CET) Date: Thu, 14 Dec 2023 08:35:27 +0100 From: Francesco Dolcini To: David Lin Cc: Brian Norris , "linux-wireless@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "kvalo@kernel.org" , "francesco@dolcini.it" , Pete Hsieh , "stable@vger.kernel.org" Subject: Re: [EXT] Re: [PATCH v2] wifi: mwifiex: fix STA cannot connect to AP Message-ID: References: <20231208234127.2251-1-yu-hao.lin@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello David, On Thu, Dec 14, 2023 at 02:22:57AM +0000, David Lin wrote: > > From: Brian Norris ... > > Nitpick: "fix STA cannot connect to AP" isn't the best commit message; that > > could describe an enormous number of fixes. Maybe something more like > > "Configure BSSID consistently when starting AP"? > > Thanks for your suggestion. I will change commit message as you > suggested. Does it mean I should create another patch from v1? Just create `[PATCH v3] wifi: mwifiex: fix STA cannot connect to AP` Add the change suggested by Brian and the tags you received on this v2: - Reviewed-by: Francesco Dolcini - Tested-by: Rafael Beims # Verdin iMX8MP / SD8997 SD - Acked-by: Brian Norris > > Not directly related to this patch, but while you're expanding the size of this > > command buffer: it always felt like a security-hole-in-waiting that none of > > these command producers do any kinds of bounds checking. > > We're just "lucky" that these function only generate contents of ~100 bytes at > > max, while MWIFIEX_SIZE_OF_CMD_BUFFER=2048. But, just add a few more > > user-space controlled TLV params, and boom, we'll have ourselves a nice > > little CVE. > > > > It probably wouldn't hurt to significantly write much of this driver, but at a > > minimum, we could probably use a few checks like this: > > > > cmd_size += sizeof(struct host_cmd_tlv_mac_addr); > > if (cmd_size > MWIFIEX_SIZE_OF_CMD_BUFFER) > > return -1; > > // Only touch tlv *after* the bounds check. > > > > That doesn't need to block this patch, of course. > > > > Brian > > > > I will modify the code for next patch. I would suggest not modify this in this patch, we should fix all the code that is subjected to this potential issue. I would personally do a follow-up patch just to add the check to avoid overflowing the cmd buffer everywhere it is used. Francesco