Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6008738imm; Mon, 23 Jul 2018 09:47:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOjSpy2y2vB0XVqGWn0TgHdLbMUdm9wAslgzmftP7240QO/rYNp/d923NmPdg2zPvkOjF9 X-Received: by 2002:a63:1262:: with SMTP id 34-v6mr13190961pgs.154.1532364457855; Mon, 23 Jul 2018 09:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532364457; cv=none; d=google.com; s=arc-20160816; b=ozUH4nGucUHdEXLalDBXV5Lg/JWcbdcy9G4r4JH+PsVHNOt5iGX/3Yqx0WB9mYwTbe BTG7otEpW6jAbAAYoggMKUBtT5iwEZMAE2thAdmL0O0bFI6nFCLRgP/tH6mJvVfV20zC V686BEXRnP2GmyHWVcW+aInsewkiFcspUZY+Fi/kpGAgRY0c5DMnd/5DaVGLUGUJ6Q7v xtw6S634ygeSeW8pUYSG1G/eI7GIjXf9eirOThC5c/hXXamjvqZ2wDgSOmMhTbH6AxlB NsKV/i9RXMn9T+QaQZV15LGxLPIah9yl8yR1JswLYuZo7ejh4Xe6DeBel31HkW2WyZBp vBCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=CGHuju4mhoLAoedxFIDqQaJGgA9DjkBMXizSOSS84Pc=; b=aHM5s5gdKdVAmPV1ngbVnYFFjd2JWT4yqPNo9nJ4PviMsaTO/34yPKKWqLDAXgzZQf gGzg+2q085aCS2bIa9DGbanEtKSRK9soZPQg1vhNuotu3xvFzJCSvpQdAxveck1vpTGx 7cok+PlRZT6/6hhcp6SwVmBrK7vYroGaD0FPE466CxugJ85rJoVGj3wfMZn+Ad/cQ+Uv mQuGz+H2+kSSDdkT0LN3gryJ7h7UJttzgi8u0clHVzff0RBX9VsBqaSgX36W0wQpuNgc Tj5IUfG5fi0WgbO3ANNydy8+5A3mEInS3eemJbXXoNQVMvHGD82VZtIljkUUFqzRT+8y nsbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mobile-devices.fr header.s=google header.b=CIKbN0t3; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TjwvVvTr; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4-v6si8100145plo.208.2018.07.23.09.47.22; Mon, 23 Jul 2018 09:47:37 -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; dkim=fail header.i=@mobile-devices.fr header.s=google header.b=CIKbN0t3; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TjwvVvTr; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388869AbeGWRrs (ORCPT + 99 others); Mon, 23 Jul 2018 13:47:48 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33428 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388563AbeGWRrr (ORCPT ); Mon, 23 Jul 2018 13:47:47 -0400 Received: by mail-qt0-f195.google.com with SMTP id c15-v6so1287816qtp.0 for ; Mon, 23 Jul 2018 09:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mobile-devices.fr; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CGHuju4mhoLAoedxFIDqQaJGgA9DjkBMXizSOSS84Pc=; b=CIKbN0t3NZZuy9RtlyyFU1UKr+iGc6NJS3VNDU9pnKCzKlOUtX0mLeT3U/GEf3K3QW vsy9xJVVPyF7hYb3SkoEVwKL7tCDQr4+nF4XYhmn7AmyNUIb0SvcGmQRuVZFF6fhWyh7 lyL0hP9s3N5kTO6NvC0ET/Sdy51LDmwhwLWgo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CGHuju4mhoLAoedxFIDqQaJGgA9DjkBMXizSOSS84Pc=; b=TjwvVvTrorzkepUwzTjPHFegkWGd/9fl1jQ43gy/JEBmsS4uMFxe/zwnQwmt1GAMCL b6/NbV/u68968/T3vtEfh1GzhCWecqmivau4ysttCrkvRQVK+aH99+bs6Qq6l/0bQGx2 VDRdorWiQuvqDD0CS1UGAEEGpraVeQC+SUTXBYF9vVv5VG10DrSdXlxiPl2yDbQ2CVTg 7rWUC/hnj8d8M4Cc2vmT5MQM3tKvsuI3Asn6MiE56I7DTiYaGt9FO56IDgHQtqsibp6x 44F2FORuHjy6xGheJLIcVY2f2XPeOMkGaU9R4CFoOCQB4+Y2IvtPpL19UOv0qgblr4k4 a50w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=CGHuju4mhoLAoedxFIDqQaJGgA9DjkBMXizSOSS84Pc=; b=Dm2GIkIv/Z5fwLbCRpMYyx4EteyOHRPNnnQoF7WeSUea5EkJoypFV/iEgBOSAG7tpI cX2zj5/d6vyCneOryCgViiksDD9DmBhLz8ZOHZQAG2gRhVbNgYRIAis4//SZT9LOJt5m Qd72r8L/a4a8UxlyAhR2Qv3k1miO4208DIE0JvisUDkGw4MIvDmBHFCAP738lO+rQOyW DFJRTsi4ZkmnMnjCmqH2hWhwXWRiRnDov72ICmmnHX41i6cMdvgT4a7i81tRrKNJsIBn JiY9AGAUV7TvfjKoRaOkpGjM2AzRccnOTy8CmyCCt//Pwv9w0TDbDiTEDF3E84YN3M5U 5DbQ== X-Gm-Message-State: AOUpUlGvpGU5VCTsmKt6erjoW2NGOcng2GhbwZVccjkm8QvdMVbPSuuX oFk1ZJUQbLNiHEl7t5Ej1jUtIWw8Nmj4IVdiohflxw== X-Received: by 2002:aed:35ac:: with SMTP id c41-v6mr13204073qte.267.1532364343324; Mon, 23 Jul 2018 09:45:43 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:2edb:0:0:0:0:0 with HTTP; Mon, 23 Jul 2018 09:45:22 -0700 (PDT) In-Reply-To: <20180723140801.GA4835@kroah.com> References: <20180723140220.7166-1-romain.izard.pro@gmail.com> <20180723140801.GA4835@kroah.com> From: Romain Izard Date: Mon, 23 Jul 2018 18:45:22 +0200 X-Google-Sender-Auth: X-R0uOtZQeopeDoBIdkrnY2pVjM Message-ID: Subject: Re: [PATCH] option: Do not try to bind to ADB interfaces To: Greg Kroah-Hartman Cc: Johan Hovold , linux-usb@vger.kernel.org, LKML , stable 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 2018-07-23 16:08 GMT+02:00 Greg Kroah-Hartman : > On Mon, Jul 23, 2018 at 04:02:20PM +0200, Romain Izard wrote: >> Some modems now use the Android Debug Bridge to provide a debugging >> interface, and some phones can also export serial ports managed by the >> "option" driver. >> >> The ADB daemon running in userspace tries to use USB interfaces with >> bDeviceClass=0xFF, bDeviceSubClass=0x42, bDeviceProtocol=1 >> >> Prevent the option driver from binding to those interfaces, as they >> will not be serial ports. >> >> This can fix issues like: >> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781256 >> >> Signed-off-by: Romain Izard >> Cc: stable >> --- >> drivers/usb/serial/option.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c >> index 664e61f16b6a..f98943a57ff0 100644 >> --- a/drivers/usb/serial/option.c >> +++ b/drivers/usb/serial/option.c >> @@ -1987,6 +1987,12 @@ static int option_probe(struct usb_serial *serial, >> if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE) >> return -ENODEV; >> >> + /* Do not bind Android Debug Bridge interfaces */ >> + if (iface_desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC && >> + iface_desc->bInterfaceSubClass == 0x42 && >> + iface_desc->bInterfaceProtocol == 1) >> + return -ENODEV; > > Shouldn't you also check the vendor/product id as well? Otherwise this > has the potential to match random devices that are not really adb > devices. The only random devices are those that already match with the option driver, either with the whole device or the whole reserved class. It reduces the amount of potentially affected devices. Among those, I do not expect any of them to use 0xff,0x42,0x01 for a serial port. But if it occurred, it would be necessary to revert this change as no userspace hack would allow to rebind the interface. As this is only an intuition, please discard this patch if you have any doubt about this. Best regards, -- Romain Izard