Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2265062ybl; Thu, 19 Dec 2019 10:40:22 -0800 (PST) X-Google-Smtp-Source: APXvYqybcuz1gxwcTMxUtf+6OkauPCoeFAIp2haxgRe62l+LODmqFdRaeNSPCawPt+mINHTqFPnD X-Received: by 2002:a05:6830:1615:: with SMTP id g21mr10635093otr.49.1576780820191; Thu, 19 Dec 2019 10:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780820; cv=none; d=google.com; s=arc-20160816; b=Qy3ZXGOhbW1w7px4pWY+M/EINqHVa/mNCkQj9mgdtz33vZbdcMe1mG/W9oZHkymVTr dc1qpWYl5h9fk9Bfi2zAtpwot2CDj6otzIbjeLeCSQ+olwaZ0ihOpzhBcgacLXD7x2tS pOimKf+W52VIqHdj2KRPmMjbu91ymqYH5EhxjEk7Iv9ot3+dvahzwfO48QS+ai2gIwiT 1fGg1Fcuxsgw5D8qAmFdVOMRwXcseaHZ2aZ9xYzs6NbyMv/hf0qTVo0vddBCaDSGeqqP tEEg2FcawLkPpBFTrXtM4Ec4WqJKw3HATfbzb8fDyKLf0gin18RwyJ/0ZRaJwF8hkjrh 4QIA== 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=rnRmb1903gg03ntTfLs7jIQXTYDubZSn6BLZ04GkRNw=; b=s/ki/DmJs5nQZg0fchAEMNqUYhxLYHhk0lwTOZ69ukwa6LdkhW1DCC/y0vEcE8yVYK efZycbHALfYJNwaaq6HfDJOUuc1WnHAbbvSnYjbk2V1UhaZTltAx3AS0tEKdsigEHdWg s/1zl/iV0NaQgOTf154xIxHwQCQdQ08c7lMgZh+qDCMbaRqcc3WYWQfE+XObceIehO1z bXTFmR60Wb7lVxVCUQU7i0NMGcrGTqsnDmw1F6s8xzxl/cLFo35NUcnmzqnElM1apGp+ isWulx2DEiffCoN+GrUdJ6RUs3T0n5ZpTC6qtXPltI3MjM+HefhvwUAgpV5JWBIxmWzK 0B8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0eQ1EiFu; 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 g200si3454708oib.273.2019.12.19.10.40.08; Thu, 19 Dec 2019 10:40:20 -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=0eQ1EiFu; 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 S1727357AbfLSSiz (ORCPT + 99 others); Thu, 19 Dec 2019 13:38:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:56840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbfLSSiu (ORCPT ); Thu, 19 Dec 2019 13:38:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 193F6222C2; Thu, 19 Dec 2019 18:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780729; bh=jjTBPwkNjj4iWeR8ZqS0cI4PSSxGrsm80SbqQwZ7etw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0eQ1EiFuGR3j5FggBPY7GkGGoQvDn5+lknEzk0XCulm1EgAV4WqRbMAhbPhON0DG0 xSkreNkrjxLikpyYmJDqE8gTwwNzESb5W373i7C34RJxRkaMIcgD3Vl8jrwld0hGTT nDi9drwCNlKdlxF7AzASnAiooQ6I5CZHdLkXiV+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.4 093/162] USB: serial: io_edgeport: fix epic endpoint lookup Date: Thu, 19 Dec 2019 19:33:21 +0100 Message-Id: <20191219183213.453180261@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@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 commit 7c5a2df3367a2c4984f1300261345817d95b71f8 upstream. Make sure to use the current alternate setting when looking up the endpoints on epic devices to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 6e8cf7751f9f ("USB: add EPIC support to the io_edgeport driver") Cc: stable # 2.6.21 Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20191210112601.3561-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_edgeport.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -2859,16 +2859,18 @@ static int edge_startup(struct usb_seria response = 0; if (edge_serial->is_epic) { + struct usb_host_interface *alt; + + alt = serial->interface->cur_altsetting; + /* EPIC thing, set up our interrupt polling now and our read * urb, so that the device knows it really is connected. */ interrupt_in_found = bulk_in_found = bulk_out_found = false; - for (i = 0; i < serial->interface->altsetting[0] - .desc.bNumEndpoints; ++i) { + for (i = 0; i < alt->desc.bNumEndpoints; ++i) { struct usb_endpoint_descriptor *endpoint; int buffer_size; - endpoint = &serial->interface->altsetting[0]. - endpoint[i].desc; + endpoint = &alt->endpoint[i].desc; buffer_size = usb_endpoint_maxp(endpoint); if (!interrupt_in_found && (usb_endpoint_is_int_in(endpoint))) {