Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4807186pxj; Tue, 22 Jun 2021 08:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIM1vJ64XSF/ymNNeYcu5ICRlv9kzJiHqYUveE99+FFaPjaYXQBFYcD0nxxfv32cnQIPTI X-Received: by 2002:a05:6602:140e:: with SMTP id t14mr3281246iov.42.1624375557152; Tue, 22 Jun 2021 08:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624375557; cv=none; d=google.com; s=arc-20160816; b=fJlCrdE9MqmJrw4DAfOK5La5I+C9T2IWoR/MKjHvT411Yd/pfl9fT9YITJae5K7bYe CfbES9WJiwXmYjn3lGh6RZzJmEixi2l32QTyIAklhba5PZaqwzBlYf2IjOWGYterGlSk XpXGEI2jZ7ze4Z4RWM6dSVz7QAko0SFhH+azqVeBlttVkCGwk4Z24kUy257IaU7S4TNg 4Sm/dc3LM6/s2QuQ17TlzWI4/kQ7+e0liZnleji3Bmnl6+ImJQ5kdzAPcfcpohYeqRJu sY+1PJG59j33S1hYAm/DEW1gEWSt/mNsylcm2OxZnXJ7DqGZjUHCeLIFEooiV4n8zzQ1 20CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dmarc-filter:sender:dkim-signature; bh=qdJZxu++vGAng/43VaeTldg+8gyYf/4ml4ovXBB/hbE=; b=I1b67G+rverh3SVQ92OyWv+ORDGGiw2m33h8ZjoK4LXsf89YqqKww6l2d06EgKWeKP 39d8CEnIPt0cCdifWCmCaOOhRBUysmOKtyCKG2AdGkeaiTz51oI3b6GCds2DOO0q2Y21 1RF73+XWOzVUp8G3Qe4QY1r+JTxVdWUFokO9cJskJDmgqDk5ufMyyyGROIm4AXiqMQ6u acfaylgA2vEMXJcyDNdvOiwmMKxD1CO1XIK5RSiJog6KmBf4kBnePea3US0X8DGcgef1 XkQGjVYoJ6agfxTwb2OKZXVl+0MsnOYg1PggPmlOeYc2ikf+l3XT06d367CwIywnnUdr VIIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=JfHn5I0z; 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 d25si24703989iop.15.2021.06.22.08.25.44; Tue, 22 Jun 2021 08:25:57 -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; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=JfHn5I0z; 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 S232226AbhFVP15 (ORCPT + 99 others); Tue, 22 Jun 2021 11:27:57 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:23288 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231987AbhFVP14 (ORCPT ); Tue, 22 Jun 2021 11:27:56 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1624375540; h=Date: Message-Id: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=qdJZxu++vGAng/43VaeTldg+8gyYf/4ml4ovXBB/hbE=; b=JfHn5I0zOE5hlzdwgn5ALrQy2F7NbXTR+BsI4mkSxiZMsij7FEL3UTpsLxqHO+tUtEaWpXmQ uDK2e/KCdVtuTLTsoB1QH0lqNwu2id9XSUQYVqu7rvS4HJjVvxkbxBQvFf0QZAK1cFd0PaPl AfPhsoa1Vt850nRkY2xjyGCl1Jk= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 60d200cf1200320241eecd4b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 22 Jun 2021 15:25:03 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EF713C4360C; Tue, 22 Jun 2021 15:25:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,BAYES_00, MISSING_DATE,MISSING_MID,SPF_FAIL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from tykki.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id CF54AC43460; Tue, 22 Jun 2021 15:24:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CF54AC43460 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] mwifiex: Avoid memset() over-write of WEP key_material From: Kalle Valo In-Reply-To: <20210617171522.3410951-1-keescook@chromium.org> References: <20210617171522.3410951-1-keescook@chromium.org> To: Kees Cook Cc: Kees Cook , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , "David S. Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-hardening@vger.kernel.org User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-Id: <20210622152502.EF713C4360C@smtp.codeaurora.org> Date: Tue, 22 Jun 2021 15:25:02 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field bounds checking for memset(), avoid intentionally writing across > neighboring array fields. > > When preparing to call mwifiex_set_keyparamset_wep(), key_material is > treated very differently from its structure layout (which has only a > single struct mwifiex_ie_type_key_param_set). Instead, add a new type to > the union so memset() can correctly reason about the size of the > structure. > > Note that the union ("params", 196 bytes) containing key_material was > not large enough to hold the target of this memset(): sizeof(struct > mwifiex_ie_type_key_param_set) == 60, NUM_WEP_KEYS = 4, so 240 > bytes, or 44 bytes past the end of "params". The good news is that > it appears that the command buffer, as allocated, is 2048 bytes > (MWIFIEX_SIZE_OF_CMD_BUFFER), so no neighboring memory appears to be > getting clobbered. > > Signed-off-by: Kees Cook > Reviewed-by: Brian Norris Patch applied to wireless-drivers-next.git, thanks. 59c668d700be mwifiex: Avoid memset() over-write of WEP key_material -- https://patchwork.kernel.org/project/linux-wireless/patch/20210617171522.3410951-1-keescook@chromium.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches