Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1156767ybf; Thu, 27 Feb 2020 06:04:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzGYEvWzr4YWgD+q3GoKpWT0nWwoV3hoDsjQSfjJh3mp6Zqmkl7UzOJh75BAHmfHAM2PdtQ X-Received: by 2002:a54:408f:: with SMTP id i15mr3298176oii.64.1582812291255; Thu, 27 Feb 2020 06:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582812291; cv=none; d=google.com; s=arc-20160816; b=TjdiDvEzJUpuP8SjExQ338J2yHDy8HEnA+ihBvv/LdcPULVi3PVPWxV+UMivg3klK2 +vR3XQVPTcswD5lcBfRZMMQ9xz8amEvO49L5o5PqVVzgHBCGBjxa3CAPqg3jIlUPjVG5 QLoB1NXC/PqnBC8zkWSUbHjsAy5qGogRnOmLA/bD/hD7ZoB9Tjtky+9KzFmqOm2xfmGK opc8PrPmo+twUG5jHrnzl4X3zrfdmMvMkbE08CysRZYspH/fvNtGBDP46V6lJ7Hu6/Tz JhMdVtjDdD8M0gUlhRua5ZD5ejO8QnEpdszSJDSQ/nRIlIxmVr7QjD9RLPc3wMRKB8ZH to4A== 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=eFq7PKO/1BRrUYFP9T9P852+C54zu/er4CbUWJbYfho=; b=GEIKnFoEWyPLSMxD8o6JYCc+Qu2zKQqF8WnWObHAa1r06QG9rUn6bRALwujJok8LM0 97e/NTrUTqCiyzLr3eOOnlHGyJBaVf7hyLiamZVDP4XHUPZRL1hz6x907/HeRjBS4ne3 Q6XeuWm2/q4nRMEgAKhvV3er/PqC4oZm5CGzJ71BYXZNzf25kG/Njljg7u+buu+lxg0l 9WgJa9DWXwz2ObfYQR/U3eshts1essIo/zZXKv+2Y3PRgu5rr+cmU1rAzZVOvY/E40Wj zmUnMKMZoumRgBh95j/vPAvp5NKzFuK2ikjFJ2r9M4RqU7tWnlFHu099PJLC4+oldRIw Iecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dkJkxj4U; 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 c11si1274446oic.20.2020.02.27.06.04.20; Thu, 27 Feb 2020 06:04:51 -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=dkJkxj4U; 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 S1732867AbgB0ODv (ORCPT + 99 others); Thu, 27 Feb 2020 09:03:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:39312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387463AbgB0ODo (ORCPT ); Thu, 27 Feb 2020 09:03:44 -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 830AE24691; Thu, 27 Feb 2020 14:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812224; bh=YoImnijzEvH+A8LvlTxzAcelxjt7YPf0k7Fc6BGfJag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dkJkxj4UbYB3GeZFlceG3I0IeMBubl0hoX4TTBUAYEDRz6Cnhyg68TC7cJE4yJ/sC JRSC7lenf2gG8LBMRykUXpX24wcnDH6PRksKQ4rwbmQn/gZz2cCvpFHhg+xjVXps+Y psaIhD/52qljZIoUrTfk+zAF8J+w7/fWzWaMhsp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pietro Oliva , Larry Finger Subject: [PATCH 4.19 33/97] staging: rtl8723bs: Fix potential security hole Date: Thu, 27 Feb 2020 14:36:41 +0100 Message-Id: <20200227132220.020655108@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132214.553656188@linuxfoundation.org> References: <20200227132214.553656188@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 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 @@ -4236,7 +4236,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; }