Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp644111yba; Sat, 4 May 2019 09:36:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZeCV3YuqG8p4e/EgQ9jVfs1Aj+O8S1lousKQFUiPTcN1S2NZBbFFafO7T47rD32lzQxkr X-Received: by 2002:a17:902:442:: with SMTP id 60mr20196829ple.107.1556987815404; Sat, 04 May 2019 09:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556987815; cv=none; d=google.com; s=arc-20160816; b=pxSbvePeIt+bo7d7JzoAJ8p1WpDrLu7yXEyQk4fZDWb+T/1IkZ/zPbp8c3IDwU2mRB EpAfzc83jKni1Rnz3xiZG3E3L554MWgsvDtepxid01mCNGmiV1p5G1hcVHkxUmazCYa0 kPgPY7eZITuDfMQBG6mcfl2zCPdT/3MaBXak8gwOGXDGNAO6xRaa1/TZCgwP54v7eH+7 ZpAtYN2RuY8ZNk31KkxMZQITsEc0kghByYPmPcPW50YJdxv6EIDzbtWYlZgctXMNATl5 z/sz1hAyhBr1GJuabtLkH8Cn2JdSb7zXYpXCXMa7QHvhMp93DYe9BlC5F5FNGMPlQmOT HBkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date; bh=dHVX+tAxj7An0bXwfa/U8GeDLsLcntgB5IjosjxuNYM=; b=hcu9rMlowAAxpQa0n6L0CTEqYW3Jie+tyBdgb8/3Y5z2Rv0zrqDXSxrnX4L0DSUQaG iALi3n89Xmcb0goxob8suIVuLXTkK/CGlqTy3nF2tICjbRsye53hAkiAi2ZQ/w6SFQ/i GmBL6C2+xRrfbJ0m9BouLBBAUo08jkzoysV7hZgxpV3erE6bI99sBYCBVSlMog0gTIpw Wa4W3yR39VlUv3HciqzSspS7/bmsClgjJJVfkik0SWrSbE5BMeRMy6Xv8slQ24+OaMSU 1AuzWSThREj8a+25GohWIZiEUcgJ+UfI4eQ2V9uRLEa4Avb6J0Q3ZQT3edeKnJJGFsBU sijw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si1584026pgm.230.2019.05.04.09.36.39; Sat, 04 May 2019 09:36:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbfEDQdD (ORCPT + 99 others); Sat, 4 May 2019 12:33:03 -0400 Received: from 0.ictbs.com ([203.137.112.168]:43172 "EHLO 0.ictbs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfEDQdD (ORCPT ); Sat, 4 May 2019 12:33:03 -0400 X-Greylist: delayed 382 seconds by postgrey-1.27 at vger.kernel.org; Sat, 04 May 2019 12:33:02 EDT Received: by hq.local (Postfix, from userid 1000) id 0754F66477; Sat, 4 May 2019 18:26:33 +0200 (CEST) Date: Sat, 4 May 2019 18:26:33 +0200 From: Victor Bravo <1905@spmblk.com> To: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Kalle Valo , "David S. Miller" , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, linux-kernel@vger.kernel.org Subject: PROBLEM: brcmfmac's DMI-based fw file names break built-in fw loader Message-ID: <20190504162633.ldrz2nqfocg55grb@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The brcmfmac driver seems to have partially fixed problems which prevented it to be used in shared system/kernel images for multiple hardware by trying to load it's .txt as ...txt first and then falling back to .txt. Real-life example: brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43340-sdio.ASUSTeK COMPUTER INC.-T100HAN.txt failed with error -2 brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43340-sdio for chip BCM43340/2 Unfortunately this doesn't really help on systems which use static kernel with firmware blobs (and also text configuration files in case of brcmfmac) built-in using CONFIG_EXTRA_FIRMWARE, as CONFIG_EXTRA_FIRMWARE doesn't support spaces in file names - kernel build fails with CONFIG_EXTRA_FIRMWARE="brcm/brcmfmac43340-sdio.bin brcm/brcmfmac43340-sdio.ASUSTeK COMPUTER INC.-T100HAN.txt" for obvious reasons. So the only way here is to stay with good old brcmfmac43340-sdio.txt and support at most one brcmfmac-equipped machine per kernel image. Please consider filtering the DMI strings and replacing spaces and possibly other invalid characters with underscores, and/or adding module parameter to allow passing the string from command line (using brcmfmac.tag=t100 or brcmfmac.board=t100 to make the module load brcmfmac43340-sdio.t100.txt seems nicer to me, and isn't prone to breaking when DMI strings change on BIOS update). My brief grep-based research also suggest that strings retrieved by dmi_get_system_info() are passed to firmware loader without any checks for special character, /../ etc. I'm not sure whether this is considered to be proper & safe use, but if it's not, it may also have some security implications, as it allows attacker with access to DMI strings (using root rights/other OS/BIOS/physical access) to mess with kernel space or secure boot. I would also really appreciate not allowing future brcm (and other) drivers to leave staging area before they fully support =y. Regards, v.b.