Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4826401ybl; Wed, 22 Jan 2020 05:28:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw4yqi2YHNLx+6PIgXSlRdqr2ujLyTqfUCWEQlNhR2Ll+2mRAlCe1u0LZuuNV5Fn4hJXVVa X-Received: by 2002:a9d:6b91:: with SMTP id b17mr7386372otq.321.1579699683047; Wed, 22 Jan 2020 05:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699683; cv=none; d=google.com; s=arc-20160816; b=SLxwINy4T8oaDosaNUXCuuAd1WnpymCRN73PaVx2Oz3agisPUSyk/YCA18jB7ldO20 QL1XFOqrBJNRTui1QNInYP2Gs0FcI8H823E6RUf7y0qFOagiJJFiiVRvYC4oMSAA2NAQ mqwK7/G1ZwWQ6plC+VUjktRZ6yIaaw+pYUiz+B74QJ6FicsAyWcw0C1R+Aebm4XwqEPg vYdxwPgVhahLBxIVI51ha5uUbRRqLRf8UDBDIOxJbm7TAU8/j7zBnaZ93zzxqNXtmW22 BPaR0KzMWYjtg0X5m3sn8zxX9Y6h27d2QojK33hGCrZV9LAQuqp0EIrpJ7RG7jDom+u6 +pHA== 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:dkim-signature; bh=JGlPSemqgZDil7cDItMJ+L52xVaHCjlayc0NKzo9674=; b=GOyFd9gVWhIqHB/fp/ouNYRsc5VpPIouKPGj8AUJuK8azv+TYyet5rHIbP70Urz5mU d5LV+u/wOd1R1mlB/Z2tF5fnjVCdM/nmcmDFFTKctA9jOPC3haTj1+jFigK8U2bk/3B0 qQAV3zIj0tapsgzjlr0Jw6H/9n0ZpuCrByNRrmVJHR12tXBlrbad449hQ41AwJE3r42I 2iPzpgyMD8MAAE9LdFaogTgiQYdBFjno4Y0bpmoeK4sOlv0x29d/Vp+LXDfKjHFi3vUR WRNgkRAALUXVwE0wWkOx/etO2XoN/5ysJUNkjSa8Y2XNpXxtW2ai7NTtIpwgtwo1aYvk cNCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZEv6YYrn; 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 a205si21781602oii.95.2020.01.22.05.27.51; Wed, 22 Jan 2020 05:28:03 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=ZEv6YYrn; 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 S1731682AbgAVN0t (ORCPT + 99 others); Wed, 22 Jan 2020 08:26:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:47842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731301AbgAVN0r (ORCPT ); Wed, 22 Jan 2020 08:26:47 -0500 Received: from localhost (unknown [84.241.205.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6800B24685; Wed, 22 Jan 2020 13:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699607; bh=8MLR2a1b0otidC3PFFMbXz7apW9xfuUu1E1XAiOutQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEv6YYrntwwNP8RjnZtCOmX1DlWnYbQXT+kQUMXXZlcX1tYu/yIDIerspobNAEVdm kxYQNeYPPTL0i2+Mg7nO1ZgeJbZU1/dFAbNMPG3G67woJLV1T7Z7TX0r55lwkOWPdG IgCruMi7lkMTAkwSMlaOtJNz3pnxioQfTbEIx7Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, hayeswang , Johan Hovold , "David S. Miller" Subject: [PATCH 5.4 147/222] r8152: add missing endpoint sanity check Date: Wed, 22 Jan 2020 10:28:53 +0100 Message-Id: <20200122092844.254085651@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Johan Hovold [ Upstream commit 86f3f4cd53707ceeec079b83205c8d3c756eca93 ] Add missing endpoint sanity check to probe in order to prevent a NULL-pointer dereference (or slab out-of-bounds access) when retrieving the interrupt-endpoint bInterval on ndo_open() in case a device lacks the expected endpoints. Fixes: 40a82917b1d3 ("net/usb/r8152: enable interrupt transfer") Cc: hayeswang Signed-off-by: Johan Hovold Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/r8152.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -5587,6 +5587,9 @@ static int rtl8152_probe(struct usb_inte return -ENODEV; } + if (intf->cur_altsetting->desc.bNumEndpoints < 3) + return -ENODEV; + usb_reset_device(udev); netdev = alloc_etherdev(sizeof(struct r8152)); if (!netdev) {