Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527393pxf; Mon, 15 Mar 2021 11:32:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxdLHLt3S6sG4hOZfYbomfdOTEzYWNf2rZakzNMJpFqegoxqHQ0T+exiAO79jtVqJmNZ4G X-Received: by 2002:a05:6402:3550:: with SMTP id f16mr31181646edd.134.1615833157830; Mon, 15 Mar 2021 11:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833157; cv=none; d=google.com; s=arc-20160816; b=OFIBUphwgjYQi0W3i5ZU0gq3qlMQhdV3S0QhLtCIQ+yz/HWSOK8nZpehVvcmAl8WOl YJj/X9Dk4cur0VROUTEixLNPnamzeS/78aJybJ5tR6UGEg3BOirYbq5NJ2eeLmfMWrSG PD70IlChDEcah7w4s+OVvP6umUJMgQGMD3WV90yT337pIDzqhFIYuMclUElVQaJvEtG7 DYhEUgNNdmm2osXgR+koYJAa/xlNiim+1mBbIPAU52tcSYeRXZaBIItvLAaW+sWglWsC FbNG3w2R/ImlJPMp133CSFD973ZmNGQIDaagKa9XtfV+UwYvAtMdDC5DGtrQyPO+wprm 2wyA== 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=qCXHotO3UGbPo6DoqDLJTAXcEJ8MMwgPYPWVPxK3Ia8=; b=YHoPWzuUjaTyId5ymdg51A58hoVyMzAZncBVTpOwQOABhsaVWRDkPgLsF1wcD7wWQu RbJC/I3A+9dIMNCCBUF1r+I6PnpcEKNHtz+iPS8pG121U8QWmnfzR2AU8Skhp0YSQvvI SVkjMJSUlHoIQRlwikvusAP1y/bbmfwQAzu44fh5pfc5BBkXj9cGECkPuQ13ZjE9sxQh hRKt7hCt9qVPaVD4nkc5AXHVyivVZ+Og7wL8MJA/wNN0i7BIKaC27PFzgZkMgD0MbJRQ Hqwihq1/s0IyW2+8Jx+EXVstpRN7qh9yg+5c+5haR5kTb7aObcQUq4Sy3IB3PxkVUgQf yGfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H4DSw0Wc; 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 y3si11699206eds.265.2021.03.15.11.32.15; Mon, 15 Mar 2021 11:32:37 -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=H4DSw0Wc; 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 S238183AbhCOOmZ (ORCPT + 99 others); Mon, 15 Mar 2021 10:42:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:49470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbhCOODD (ORCPT ); Mon, 15 Mar 2021 10:03:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7C9C64EEE; Mon, 15 Mar 2021 14:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816982; bh=y936yeVlW7Axkpod6hrD2yfHxzmIRGBM0q+s8LL4oas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4DSw0WcDbhJuDWobkN80p5dXaGqCAIASFC4OBoXmAynN8OXGcDuo460j5+7e/zmH opIU+BpR24AP9LjXOp1LG7VN7hcvcsH1QtU3Czg02wUJFpFzo14XQQXrDfZj/Geb3m 1oh0rMR94TCgGkSXrqAZp0qieZGEsGwnm977L/R0= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 5.10 227/290] staging: rtl8712: unterminated string leads to read overflow Date: Mon, 15 Mar 2021 14:55:20 +0100 Message-Id: <20210315135549.650901835@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -924,7 +924,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);