Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933535AbcDJTe5 (ORCPT ); Sun, 10 Apr 2016 15:34:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54675 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933264AbcDJTTP (ORCPT ); Sun, 10 Apr 2016 15:19:15 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum Subject: [PATCH 3.14 16/76] USB: cdc-acm: more sanity checking Date: Sun, 10 Apr 2016 11:36:24 -0700 Message-Id: <20160410183516.674606570@linuxfoundation.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <20160410183516.090999097@linuxfoundation.org> References: <20160410183516.090999097@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1007 Lines: 33 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oliver Neukum commit 8835ba4a39cf53f705417b3b3a94eb067673f2c9 upstream. An attack has become available which pretends to be a quirky device circumventing normal sanity checks and crashes the kernel by an insufficient number of interfaces. This patch adds a check to the code path for quirky devices. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1079,6 +1079,9 @@ static int acm_probe(struct usb_interfac if (quirks == NO_UNION_NORMAL) { data_interface = usb_ifnum_to_if(usb_dev, 1); control_interface = usb_ifnum_to_if(usb_dev, 0); + /* we would crash */ + if (!data_interface || !control_interface) + return -ENODEV; goto skip_normal_probe; }