From patchwork Thu Feb 27 13:36:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 230298 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EADDBC7656F for ; Thu, 27 Feb 2020 14:28:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B975924688 for ; Thu, 27 Feb 2020 14:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582813681; bh=wgwUsXD3MhMy864LF60dbSO9NBJsQUwXPuA+0vferc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gfzoUKeNFBCZLWCxHuF6hps9Q/wyOuoajkBZidHY//cuorCVl7LwKtUIbDCULPhQi +8KipeE5iJydraLfct5Q9VaSbWcDhQ4R2Xnzutr/CViSxPwr7jIEUh/ufbWT+pCW4A L7K0Wpt7HEb3fB+BGi7Lzb/TkI/4Q3SuNld43fAE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388217AbgB0OIT (ORCPT ); Thu, 27 Feb 2020 09:08:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:46072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388227AbgB0OIS (ORCPT ); Thu, 27 Feb 2020 09:08:18 -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 6ED1B20801; Thu, 27 Feb 2020 14:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812497; bh=wgwUsXD3MhMy864LF60dbSO9NBJsQUwXPuA+0vferc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQ9Yqxm8Q0RX9q29+/hIYkIHCw5//DiRbJBLqypogg34pvsdkSsEsq9WtZPfmIN5i xKy5g7TmIJRl0atEF/x+xXej1lYROwBqfx1T5sjRZXlu6Q3wew1SiFd++IpO+ZPRn/ yAu1vpxDXSVmOB6cVJ+IRdeaplXPlLF02vJxBFNY= 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 040/135] staging: rtl8723bs: Fix potential security hole Date: Thu, 27 Feb 2020 14:36:20 +0100 Message-Id: <20200227132234.923912732@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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Larry Finger commit ac33597c0c0d1d819dccfe001bcd0acef7107e7c upstream. In routine rtw_hostapd_ioctl(), the user-controlled p->length is assumed to be at least the size of struct ieee_param size, but this assumption is never checked. This could result in out-of-bounds read/write on kernel heap in case a p->length less than the size of struct ieee_param is specified by the user. If p->length is allowed to be greater than the size of the struct, then a malicious user could be wasting kernel memory. Fixes commit 554c0a3abf216 ("0taging: Add rtl8723bs sdio wifi driver"). Reported by: Pietro Oliva Cc: Pietro Oliva Cc: Stable Fixes 554c0a3abf216 ("0taging: Add rtl8723bs sdio wifi driver"). Signed-off-by: Larry Finger Link: https://lore.kernel.org/r/20200210180235.21691-3-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 @@ -4213,7 +4213,7 @@ static int rtw_hostapd_ioctl(struct net_ /* if (p->length < sizeof(struct ieee_param) || !p->pointer) { */ - if (!p->pointer) { + if (!p->pointer || p->length != sizeof(*param)) { ret = -EINVAL; goto out; }