Received: by 10.213.65.68 with SMTP id h4csp1772759imn; Mon, 19 Mar 2018 12:52:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELtO5OmdkpywDEYZ5cEcaJUEZ1beDFBX/raVeP71IYLe5b0W58rE+B+Dd96lRpDhiC7wIzxk X-Received: by 2002:a17:902:f81:: with SMTP id 1-v6mr13625825plz.265.1521489149941; Mon, 19 Mar 2018 12:52:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521489149; cv=none; d=google.com; s=arc-20160816; b=qaEVUxk84LavP8afyou26IL6d4zLywsDgv76jjiS0zcUJNvs3Xfazlqu5+i7NwPkrh m0HfqT4CHlUdXhYYwzh/JgQbNPPqXIEUEcX/o4WXZMrxEbD+iteAul4Ac1DlIGVNrmXc cVnIJTNMTd18aKQ8s/LS8uzHeTYvK3iV3enmsblQVmYdkrcGwLjSCkn8oC/SOOY61SOU u6nXRAeZ8Q7Mi/xsEpzSPcz8MaED4aDQhqT4J4myBK8hNNS4VKWq9ztrAQV4aqWLhuPN y/wco+NikVBOZ1gh0DCuvcLRvjFkQwzQ5HA654ksqW83M2yEI4QRABK0ixzM2kNS+vWh rDag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TdQsaFgk7FpD4F0dQzMzCERRCer82wdcw3bBJ2TgtGM=; b=HXKMv0JoM5mt8+8hF6cPx7cy0/sqp5De5c1Ji3ziwHEouuu/SPZAnXq64jx5kXuQB5 IMo1w66soWDOxD9B2s4MHVTxczcPE4iRD7LPOSw8REKlvHDBWBHqdgd10L99x/UtvT9Y UKn3coak/2ElrQUuk2wobOAI0ywoZvamo0KwhisIrWnRLMgEt5jHD2NG2MArd9uwu4fe K2PW+7kasyOmO6rG7Z/KkAg2xZqmn0ta/2Ddy1ujji5QtnJBLrfDp9sctdhXrcIN5vYX Y6jj4ntjHeHyhRB0c/lNODUQckhfmspG45MLsW7V+HgARJcEOxHwlzDhE8AY7veMrOa3 Ci4g== 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 33-v6si571935plf.98.2018.03.19.12.52.15; Mon, 19 Mar 2018 12:52:29 -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 S970329AbeCSTtY (ORCPT + 99 others); Mon, 19 Mar 2018 15:49:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47452 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030927AbeCSSUA (ORCPT ); Mon, 19 Mar 2018 14:20:00 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D548210D0; Mon, 19 Mar 2018 18:19:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Drake , Johan Hovold , Kalle Valo , Sasha Levin Subject: [PATCH 4.9 048/241] zd1211rw: fix NULL-deref at probe Date: Mon, 19 Mar 2018 19:05:13 +0100 Message-Id: <20180319180753.190838192@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold [ Upstream commit ca260ece6a57dc7d751e0685f51fa2c55d851873 ] Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer or accessing memory beyond the endpoint array should a malicious device lack the expected endpoints. Fixes: a1030e92c150 ("[PATCH] zd1211rw: Convert installer CDROM device into WLAN device") Cc: Daniel Drake Signed-off-by: Johan Hovold Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c @@ -1278,6 +1278,9 @@ static int eject_installer(struct usb_in u8 bulk_out_ep; int r; + if (iface_desc->desc.bNumEndpoints < 2) + return -ENODEV; + /* Find bulk out endpoint */ for (r = 1; r >= 0; r--) { endpoint = &iface_desc->endpoint[r].desc;