Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1342888imm; Tue, 2 Oct 2018 06:50:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV61VEVbXrxx2G0EfvVYd9YwSDDl4U3J3mKeKesCukqG8LCqLIhXOwoy5dxu+Tw8bSx99HV3k X-Received: by 2002:a62:aa17:: with SMTP id e23-v6mr16379046pff.211.1538488203552; Tue, 02 Oct 2018 06:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488203; cv=none; d=google.com; s=arc-20160816; b=LOPgS5aaBaD8PjEN7eQqTYivihg3fDPNacSg/nsy4R099cjxMFDckodB/KXq+iKD04 dmXw5esLpqhTcBTQcvCCRH8i2qc3SrKQbcdZsd+WWoR2y8Hjpywc7jgU/CUGgSNlaegM o6tv9WxjJyDoJxfeWESD3bM29qKWoW1y0vK1Ccs82CvTRwOtSumNqLFKZrf2Fdg7oFXa 30xf/wk8iYWTNuRvx5SHkvVhDBY3VOPra98mUdKa5xrHxO8aoCny/lRbsqYCXAShLkCD wuJtTg8rKHozBktPlHfUs+9QbQzmCmGXST8GO55H8kY1o1eaHKFUkLp6aOZB9MhXJQfG fYkg== 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; bh=QLmwmCVNdTyDiFZ9PNlBgZCT1zQHmI58NarFlGHoORM=; b=eddVBE/slo9zWwmEvopICEELhe/Gr/B1XzLDlzgih9mjQn3LYieGpLi3Vci/47JqsQ aVzPYi2xhmn9eZJOAHljKPybSg6MU1Ic1h3JWqykOSaGBLoL3yGTLk3nm4sJfdWP+GFX 4EN3O2pe25E1eoBBTWvE3jNd5MpI0OzxJbsYz6dSVCxBQTTaojkAnhkBsxKn0WCRJPwv T4msc88oYOpvmrMFIczXw9Og1vJt6m70q2W4CC52pKqyfRx2JdMuzAwptCp1oQdwtQ0p 1fvtqweG6N5YqCMB7U06PnzdkF3piJSDmgT0vm63bWNZVNB+VAfCf6fVovLxyQKANXeX +/2A== ARC-Authentication-Results: i=1; mx.google.com; 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 z10-v6si9831592pgv.487.2018.10.02.06.49.48; Tue, 02 Oct 2018 06:50:03 -0700 (PDT) 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; 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 S1732200AbeJBURh (ORCPT + 99 others); Tue, 2 Oct 2018 16:17:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35218 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732083AbeJBURb (ORCPT ); Tue, 2 Oct 2018 16:17:31 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 78BC7C3F; Tue, 2 Oct 2018 13:34:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 062/137] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication() Date: Tue, 2 Oct 2018 06:24:23 -0700 Message-Id: <20181002132502.917146669@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132458.446916963@linuxfoundation.org> References: <20181002132458.446916963@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit ae636fb1554833ee5133ca47bf4b2791b6739c52 ] This is a static checker fix, not something I have tested. The issue is that on the second iteration through the loop, we jump forward by le32_to_cpu(auth_req->length) bytes. The problem is that if the length is more than "buflen" then we end up with a negative "buflen". A negative buflen is type promoted to a high positive value and the loop continues but it's accessing beyond the end of the buffer. I believe the "auth_req->length" comes from the firmware and if the firmware is malicious or buggy, you're already toasted so the impact of this bug is probably not very severe. Fixes: 030645aceb3d ("rndis_wlan: handle 802.11 indications from device") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/rndis_wlan.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -2928,6 +2928,8 @@ static void rndis_wlan_auth_indication(s while (buflen >= sizeof(*auth_req)) { auth_req = (void *)buf; + if (buflen < le32_to_cpu(auth_req->length)) + return; type = "unknown"; flags = le32_to_cpu(auth_req->flags); pairwise_error = false;