Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp685447ybv; Thu, 13 Feb 2020 07:44:59 -0800 (PST) X-Google-Smtp-Source: APXvYqw3nRf6+caCQF5ttiOQCTCP3m4pHDztz3Onrs1J8G1dujZ/mpkP94BApSsNzbD/f3muLNyR X-Received: by 2002:a9d:5e82:: with SMTP id f2mr13296567otl.240.1581608699036; Thu, 13 Feb 2020 07:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581608699; cv=none; d=google.com; s=arc-20160816; b=Jr+85gMqBhUeGulcDH0wd3B0XDwxQKUW2O+ajx/qPdmHEmg6nwGWsa3f0fjh7sTy/5 OLpR/zql1lodvtv9z+6wyPacgM5DhtOl+o7Fd2/TWfjF9H9NVbIpLhXv43pDUWeA3vs7 vpJwlc7SPbcGNnRhhEvY1Eq3/KV3qUoIrb2gp0uMog96eajiGLUOCD102Dmxwg82u64C kTPuvwfYnAMa5SxaMr4FjnmwCngvo6ZZyWNp+K04zmDdElYindUJWv/oFBQ/neGdtA0+ klZRtUnxj7JlPrTlMYoOix+0fEv7HJ9XOshO5SG0Mx6cFAS6x0UaueGxYzheoMY6e50a QTMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iWt3SisAPUi7+1YLH7UikAl9z9mm6bwW92I4O06LVIg=; b=yATlI0D7zu+fYC39/8Z9OkEvq2RTJSm/xkdqlsb7JGi6lCkeMwxpsTWF4mBLSSkhqo rGcQuKUdiguDQOsg0pdmWUEPswZoLvHi953FRZBFZD5GzREun+DuB9R1CTFSY2DswMsZ YxQolWBv97Nglc8Aco/f4L1065Vgtt3cnUJeWrDyBTqs6gH2YcAr844OymG0SKJ7obXh ewjtoqDpRuH0WKw0cVamFk742Qv0Z2TQ5lSFEGYJoxgGmczJrY8DBScEM2CUM53nNCo6 +ACWPrxn+a1aQYqw/mE8K91JF0xH0QiY4CWhYO6xG6O/bzowvx/hehlTjIb4qkwhIaLS xoiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ydVFCx5D; 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 c5si1228289otp.108.2020.02.13.07.44.46; Thu, 13 Feb 2020 07:44:59 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ydVFCx5D; 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 S1729610AbgBMPnp (ORCPT + 99 others); Thu, 13 Feb 2020 10:43:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:52904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387713AbgBMP1u (ORCPT ); Thu, 13 Feb 2020 10:27:50 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 091142168B; Thu, 13 Feb 2020 15:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607670; bh=KHdrEN3OtqPPD6L5YgBi2g1IZzGbO2eK07lEomwDnVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ydVFCx5DXBM/BDNZYAO5PSX+5HOoenuOT4J5GjJIhNZIYTptLGnZosHacEsAO6b7P akX0pt1tgHZ3MNOW432yE9jCCEskSSpOWRSKH3l8lyTtKsJKLae1fXtKZ/sa/UfyHI 87W42Tc04JpYiGhNQ/XnPLB7gN9wEnMKZDFVWcjU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qing Xu , Kalle Valo , Sasha Levin Subject: [PATCH 5.4 93/96] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() Date: Thu, 13 Feb 2020 07:21:40 -0800 Message-Id: <20200213151913.789751119@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151839.156309910@linuxfoundation.org> References: <20200213151839.156309910@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qing Xu [ Upstream commit 3a9b153c5591548612c3955c9600a98150c81875 ] mwifiex_ret_wmm_get_status() calls memcpy() without checking the destination size.Since the source is given from remote AP which contains illegal wmm elements , this may trigger a heap buffer overflow. Fix it by putting the length check before calling memcpy(). Signed-off-by: Qing Xu Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/wmm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c index 41f0231376c01..132f9e8ed68c1 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.c +++ b/drivers/net/wireless/marvell/mwifiex/wmm.c @@ -970,6 +970,10 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, "WMM Parameter Set Count: %d\n", wmm_param_ie->qos_info_bitmap & mask); + if (wmm_param_ie->vend_hdr.len + 2 > + sizeof(struct ieee_types_wmm_parameter)) + break; + memcpy((u8 *) &priv->curr_bss_params.bss_descriptor. wmm_ie, wmm_param_ie, wmm_param_ie->vend_hdr.len + 2); -- 2.20.1