Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1162896ybf; Thu, 27 Feb 2020 06:09:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwV3ELMpVOB6ualVUO/LzRP/4UhSq1BQ1r7Wx2m7aV9utp7Rj4BL3Xp3HeELGpfcY3bw2SB X-Received: by 2002:a05:6830:4cd:: with SMTP id s13mr3391901otd.181.1582812593631; Thu, 27 Feb 2020 06:09:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582812593; cv=none; d=google.com; s=arc-20160816; b=I2huRIMDLX1CxMGobB4O5b4c7z/LhcVmA9zOTZ38VSHKOQmZ0QtJ97S0dZkFfA/9Bg 1RUVfC3p2L0V6h3Zyz/c3+9RJrwiwGSxw7xGwQB62trCBAmIe1mjQy3NemJJgsVlH3pg 3e2016ry9qv13LLZEo3JPO1XXE6NeZ5xPrAkFN7n3jhrfsD0GTzi+vBDuc1xVRC/TPcy rU7wfbhfjqUW6mMpmizidbUaGKMOn4UJ0QZtz8jja1peDmdZcrPIcg7hpamqQ1PIm2yz y59CVwHGMm6WV0j1D0SvPTu2cUToSgxDZopVQJ4eTzEslxpDKmFZXeFjplD2644GRbkz /eEg== 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=a/ePax/eIWgjUmIcKH74289fOvXWlqG1gOILYYVJz98=; b=blYVFj1WNZMjTUrzMm8b9XVPTJRmtMd6ZBaRnOMgR+bjZgEfHEQWrn6aD11D/9YODv C64bR0Q11iU5Dv/nbNXgp2dFLoEqas1+S1bpdYn7hm7aNiSohw6Wj2fAK3afrgn7Wcty AxnIxjiD5cLeGaJxAdaUkmASRYy3oo5/oU9/obAt+bFbLiSMJ03j48aCFk9EHz0w5Uka p+4DA7wikEH0ZSaUd7p8vlcA97kqECGDW6BrbH2vOmYR5rZd4C77Zf/GxSxd/E7CfD3l 4FUOjcSX8gZaesDpGo1Jx1kRp1kRwW/1MltPug21O7QKEmW360vBerNqqHXWYJMJj9sr dR+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wPSRobLW; 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 d125si1191260oia.86.2020.02.27.06.09.33; Thu, 27 Feb 2020 06:09:53 -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=wPSRobLW; 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 S2388243AbgB0OIW (ORCPT + 99 others); Thu, 27 Feb 2020 09:08:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:46140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388236AbgB0OIV (ORCPT ); Thu, 27 Feb 2020 09:08:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 EA59020578; Thu, 27 Feb 2020 14:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812500; bh=xuTLgFRiyEJJ09mCL7fA4XV7179OPdVEUYD3YCBHzuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wPSRobLWIPrDb2Q2K2DatotGoM694j5F1wIduCyFkI8IHgt+1NMbtcYuw57ydbxQ2 0SdpfUExzneKhSz3F3mAxnjd1p+XnF/kdil0kdXrHLFbupfkLfW4XZgEBPDSB+lxGq pFNDjpValsHYhUCnpBlkufAZiTpoY6jA7dxegCBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pietro Oliva , Larry Finger Subject: [PATCH 5.4 041/135] staging: rtl8723bs: Fix potential overuse of kernel memory Date: Thu, 27 Feb 2020 14:36:21 +0100 Message-Id: <20200227132235.072163016@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132228.710492098@linuxfoundation.org> References: <20200227132228.710492098@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: Larry Finger commit 23954cb078febfc63a755301fe77e06bccdb4d2a upstream. In routine wpa_supplicant_ioctl(), the user-controlled p->length is checked to be at least the size of struct ieee_param size, but the code does not detect the case where p->length is greater than the size of the struct, thus a malicious user could be wasting kernel memory. Fixes commit 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver"). Reported by: Pietro Oliva Cc: Pietro Oliva Cc: Stable Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver"). Signed-off-by: Larry Finger Link: https://lore.kernel.org/r/20200210180235.21691-5-Larry.Finger@lwfinger.net Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -3379,7 +3379,7 @@ static int wpa_supplicant_ioctl(struct n /* down(&ieee->wx_sem); */ - if (p->length < sizeof(struct ieee_param) || !p->pointer) { + if (!p->pointer || p->length != sizeof(struct ieee_param)) { ret = -EINVAL; goto out; }