Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524101pxf; Mon, 15 Mar 2021 11:28:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNyCtqKcqeR813oMpZfdvk8iAAVVXReXlx99IgQFrvcr1oROHu6LQJ3/g2pZzqN0ludNuC X-Received: by 2002:a05:6402:430c:: with SMTP id m12mr32353318edc.138.1615832892344; Mon, 15 Mar 2021 11:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832892; cv=none; d=google.com; s=arc-20160816; b=IN95ZRrWwbN7/9aWqwj2ihWTnHHp21m1h0VR/9ATw4NgHfzFyrPgiMCmkKfg2rwXKZ 5DWbI6cXTV831AUjsMcoPl4vVLzJhRhAx6QyiytnVHHi0HL5JKmcRRGvjTdpA9gffqEr aia24RSm19ELxza1wRFZanJcjHqoj27xCJw1zYFtCIHgLZtNwTZV2HKt6z5OLRyA9rIp 9oqDgBBYyGO2aEuq4Teg8yy8OIKkMUasZhBNox/lfxcqh7UIt8M2ujy0O+K+uvFEFwYF Rdc/qlBOZMBHiMbA+8S42M3//94Vqh5sOcKbZFhcUiHpO2+TfnFdtN2twSjFGKCYOGsQ 5O+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NYOthEz3UaZct1IDUriHd6LnI1rOoXMIvWfm0s7s9TU=; b=BzpgYffkbhpotZAsvD7v/BEGeXu+XMx6YDbL/JIk7HM+DppsxyDP2hPDOBNTBU+Osv pmOtK8DWnTUyT59gsERWsnlKt3GCt6b97kKqyZmF7UmjWSzvN3LUhVP2K99DqMWMNu2q 1UiQpnbXVDlFsGY1NlGJ9ganQysjWQ0HvBSAth9eDPNrToG00xmpaOgXe5zWBpFXyv5B 1xtS74EGumyisMpxb73vdrkFZ+2jNukHieGdj30CXLsHaeqI64hTTP/WU77c5YTXhnvn HazjPTliam/dL/2y4RIprVpcMtS0q4x1oC6eg66s1DnGojbE1zZ+FHACvdscMXGvq6aD EGtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AiLijqhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si11623936ejr.458.2021.03.15.11.27.43; Mon, 15 Mar 2021 11:28:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=AiLijqhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239201AbhCOO15 (ORCPT + 99 others); Mon, 15 Mar 2021 10:27:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232161AbhCOOAh (ORCPT ); Mon, 15 Mar 2021 10:00:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E684564F07; Mon, 15 Mar 2021 14:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816822; bh=2XcPrVQae4LksgVaX3wz+2NCpilRZm+67/GLAxR/jYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AiLijqhHVlgJzruQHKgjsUHom0QEaUiXf932dnAI/I9bYN6uxp1t2AnQTiZi+kKD2 SZc7lAcYCgamQU1g45TINba0d5lYue1eM2uBk4qQyFm+HGkcMhzX8fY0vg57zylsYN TgOF/7hNJnyuaWd28ai40Aza9arvGiYrcSvxXtWA= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 4.19 091/120] staging: rtl8712: unterminated string leads to read overflow Date: Mon, 15 Mar 2021 14:57:22 +0100 Message-Id: <20210315135722.957836292@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Dan Carpenter commit d660f4f42ccea50262c6ee90c8e7ad19a69fb225 upstream. The memdup_user() function does not necessarily return a NUL terminated string so this can lead to a read overflow. Switch from memdup_user() to strndup_user() to fix this bug. Fixes: c6dc001f2add ("staging: r8712u: Merging Realtek's latest (v2.6.6). Various fixes.") Cc: stable Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YDYSR+1rj26NRhvb@mwanda Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -946,7 +946,7 @@ static int r871x_wx_set_priv(struct net_ struct iw_point *dwrq = (struct iw_point *)awrq; len = dwrq->length; - ext = memdup_user(dwrq->pointer, len); + ext = strndup_user(dwrq->pointer, len); if (IS_ERR(ext)) return PTR_ERR(ext);