Received: by 10.223.185.116 with SMTP id b49csp1085704wrg; Fri, 23 Feb 2018 11:40:12 -0800 (PST) X-Google-Smtp-Source: AH8x224j8YE9N5nqYVk2OkD9qq7Yy7MD916hT7zXa6xJru7AYDPGlqNBhDQGFnvOjvns4QKXQP0N X-Received: by 2002:a17:902:59d3:: with SMTP id d19-v6mr2670242plj.394.1519414812502; Fri, 23 Feb 2018 11:40:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519414812; cv=none; d=google.com; s=arc-20160816; b=rLhOu7EOw9+Pq1y5B+f+L8LtGMVhnyeVLnyoNrRRJP1/VWd+wQSCn7bdXpxmux6NTs ZkXVXBkIvEHdibYbhaLPKWhy98zpAqg+e2CmVvuiCOd97kfFh8o2LT+R3Swpsfm894v2 JILrExlpP2Dcdy0d/HM1NVzIh3yKjTgntcuL7IiNoD+ZwSsMxkXxRUeGvuxrL4CSrgdJ Y1nLjwyQGiy72uSpG1h62fQTjmZ8WSf2eTbGLdoi0O/DVfc3x3IFNzoSq2dLBAZCvLor isRH77Xj5J0Pkmt4MKRNfSXdtjkkFQL1OMhmk1JtGL0+MLxGSBvoN7nH/J7mNB2jDQQv Sv5Q== 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=/Gw3Y4LVZxB3WvNbw3IxiMdzt7hh1qBZFFcI0FLxoX0=; b=RNz5wR4NB7lrBX87VGp7InOL9hcxa3ugG41/q22+gLhxxu6IRRUMsA8oxjT1T9pMPH 7P4Tyhp/z5B0JyU6MLRGOn0DpltJn3MgGR5apv21dvmGXei0mj22Q6TtLmEw+z7xDdM3 /9nELFsEZVf0m+BYDZ0RIEUMVHdtytXS9RBnVN2941NckSINLDyq234iW5fkGXdXMu5z xYty1/44ESvzmvqpQbxvWpk3r+OqUpp7hlZT952PjaTt4vac/eR26LfZHiAB7W8Ij3j1 c1Hf5U2ipzfJR/MV89NITV4xyd0atOP7TbDmo4lwBsNctrBIBeTDQrm2BEv+elx/U/Nf 4+XA== 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 c6si1862926pgn.681.2018.02.23.11.39.57; Fri, 23 Feb 2018 11:40:12 -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; 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 S1754796AbeBWTit (ORCPT + 99 others); Fri, 23 Feb 2018 14:38:49 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45470 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934323AbeBWSt5 (ORCPT ); Fri, 23 Feb 2018 13:49:57 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D479411B5; Fri, 23 Feb 2018 18:49:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Takashi Iwai Subject: [PATCH 4.14 021/159] ALSA: line6: Add a sanity check for invalid EPs Date: Fri, 23 Feb 2018 19:25:29 +0100 Message-Id: <20180223170745.762995404@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 2a4340c57717162c6bf07a0860d05711d4de994b upstream. As syzkaller spotted, currently line6 drivers submit a URB with the fixed EP without checking whether it's actually available, which may result in a kernel warning like: usb 1-1: BOGUS urb xfer, pipe 3 != type 1 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 24 at drivers/usb/core/urb.c:449 usb_submit_urb+0xf8a/0x11d0 Modules linked in: CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.0-rc2-42613-g1488251d1a98 #238 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: line6_start_listen+0x55f/0x9e0 sound/usb/line6/driver.c:82 line6_init_cap_control sound/usb/line6/driver.c:690 line6_probe+0x7c9/0x1310 sound/usb/line6/driver.c:764 podhd_probe+0x64/0x70 sound/usb/line6/podhd.c:474 usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 .... This patch adds a sanity check of validity of EPs at the device initialization phase for avoiding the call with an invalid EP. Reported-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/line6/driver.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -78,6 +78,13 @@ static int line6_start_listen(struct usb line6->buffer_listen, LINE6_BUFSIZE_LISTEN, line6_data_received, line6); } + + /* sanity checks of EP before actually submitting */ + if (usb_urb_ep_type_check(line6->urb_listen)) { + dev_err(line6->ifcdev, "invalid control EP\n"); + return -EINVAL; + } + line6->urb_listen->actual_length = 0; err = usb_submit_urb(line6->urb_listen, GFP_ATOMIC); return err;