Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3522999pxf; Mon, 15 Mar 2021 11:26:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqCIfeL6DeXLDS95wGM0L0mq99qtY/WF0ubyanH0eaGBpX07FcQnQ1plNx/e8BFJ+xasWT X-Received: by 2002:a17:906:7c48:: with SMTP id g8mr25445661ejp.138.1615832817237; Mon, 15 Mar 2021 11:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832817; cv=none; d=google.com; s=arc-20160816; b=IhZfKo1oun2ZHTcRe1WLdOhhcnfeNIlP2FfRcSllopeDhKlRIzH5uk1uD64KSV6g3o ePALa+QDikYyxwEuVJoTiGRTRdOEJndzX4dHkhuwxLw2lfe4Y2oSg3D56sOCB0B23/Ld hh3aGa+gnxBRDFMaVpHktNtci3r0reFN5DItDTw4G0yHBBZiMKqOkEyr6jNz8ORuAMrE CgYuKGasN7P2yZ9cIY4uVyz7SUX7MylB1N72G6ULxYGB+K2Yfw0Nr5YnV1UAuKAsvKpv ZxjpNieyuVWcQ2kLOGop+l7rwXOipVz0TTk/odX4vXt0QNEry2prGAJgBNE4qiOKXIYb O44g== 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=SjpkGlN4+R/xmyynS14ewsUy6uvlrTT8Hy6NO1BvRXc=; b=xib64lJCcc2OsTjD/fXs69t7HVtvsHebPSkr43TvBAtPBe8pUADZ+NApzYbtYTBM8j sH1IxOqovQEJQVUh12ERd1gyLlCfLbJaJoK130tSbd0B6iwRhJ76cFEhbwK+aW+OPnJe TFcMdXgH9OUedWkQCAy3TgcJNAjA7q5WL/LbBGTnU9Dxx1hBT9GIwGa3eDI2w44xhS+l Pzp6jO6ahuYR09PugAPZYsfPcT9M9FEv9Wwzt2KUsOo5VB2e82iV9+BZY3u0gVzoOFOK XHccJQgP4FNVkV8+9HAIS/6uGqlNpJnm8B0lM7zjxLf4I++nTymINQfahghXtjUbODw1 ETkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nyZEzxGY; 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 b10si10600977edr.441.2021.03.15.11.26.32; Mon, 15 Mar 2021 11:26:57 -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=nyZEzxGY; 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 S233851AbhCOO2d (ORCPT + 99 others); Mon, 15 Mar 2021 10:28:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:36594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233043AbhCOOAe (ORCPT ); Mon, 15 Mar 2021 10:00:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1001964F70; Mon, 15 Mar 2021 14:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816817; bh=EDYajUXI1iubV5YIC/Cxs1Ge/5eUN5vljTLiQD1ifcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyZEzxGY+weSFKKJbaSZHIpClio6/s0n+GjO+bEMB+9qW00Oo4qKP4RKRm+1cdOdF aSdFzwEr2gPiVHP90YjdUfDPyO2ofzuMFPsLz5Cxpup6VvKO/w6tqz6aOwb93w9kcU kTB1PELnC0bNRVlds8jTX8yZ4GJ+4Xj+DZZoIk1c= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter Subject: [PATCH 5.4 129/168] staging: rtl8712: unterminated string leads to read overflow Date: Mon, 15 Mar 2021 14:56:01 +0100 Message-Id: <20210315135554.583733082@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 @@ -928,7 +928,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);