Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp783040pxk; Wed, 9 Sep 2020 20:26:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0PMuhSLD42EXP4gBPAf5bScFngaTdxeBPOi3uPY7ubW54ARs1jSrjEhbJCEKgG1ZqCa+m X-Received: by 2002:a17:906:ecf1:: with SMTP id qt17mr6906401ejb.158.1599708376314; Wed, 09 Sep 2020 20:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599708376; cv=none; d=google.com; s=arc-20160816; b=VVaTUaxMleXH7Y0Ie4K3xC7IT6ejLCn+fJE+6WRz43Xgjs9ikrKbgUmhSf8fDOUEyl M+3085bk6qgWYMjuIidFXT3E/fT+tTpDvdNP4yvqoge8Ki/eaPGMo5MB1I6bSJYoDY7K phBW6KcdfQvzDw3lW1OZomo6Ksz7M1cRVoHwFzKrXojxD69cgIkYuW6oqKkqW0v3SRPN JfBtrw98X6E8EaJO6Zgfvr1kE1SG7u+hJyPMuR0ANq/MbDO/H0yG8GTAmwNruZRTafOr CVNJiogU0RttqcVYKQOYuzyPrISH3QxTyUxXrLSPBh9rgifTlZwdPkzLjh6ZHIbcc+fP V+ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=wcMDruGFkVAgjcNvAOBJGt9AfuPuFlQK4awnYYUgHvg=; b=asFX3MUbyO0XWCMZiM/My6fl/i/RYHN0kEAP1SO05skJeuwDGyDv9I9xBPiyi7SwYf /mOXS2bHhXo/oMergTPId0Xg9bpJs6g2CPaTXeVDpBQc0IcEgbSTqSfwfc1g3WJz2OTu ulcxVKHK1B/rCgdrSAWu6bN6oQWbnobWI7YKJuV9pQ1RavzSeVLP3KD2OdcUqhMpP4gh roIFSMM1ufyPAcjuWdsjbFrm6lApcyJTXv0rvYuwTiOBrb0SLcoiuh6f2ibpKZMC9v6R jMHPLMeL95oqDeZo2p4gAqwLBjnOZ+2344f7EivO/KZAP3ZnmC/Bwdn8x+yYghk6ivA/ We2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si3035808ejj.33.2020.09.09.20.25.53; Wed, 09 Sep 2020 20:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730127AbgIJDY5 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 9 Sep 2020 23:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729992AbgIJDXl (ORCPT ); Wed, 9 Sep 2020 23:23:41 -0400 X-Greylist: delayed 366 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 09 Sep 2020 20:23:40 PDT Received: from mail.marcansoft.com (marcansoft.com [IPv6:2a01:298:fe:f::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E154CC061573; Wed, 9 Sep 2020 20:23:40 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 44F91425DF; Thu, 10 Sep 2020 03:17:21 +0000 (UTC) Date: Thu, 10 Sep 2020 12:17:13 +0900 User-Agent: K-9 Mail for Android In-Reply-To: <1599706954.10822.3.camel@suse.de> References: <20200909193419.2006744-1-james.hilliard1@gmail.com> <1599706954.10822.3.camel@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH v2] usb: serial: Repair FTDI FT232R bricked eeprom To: Oliver Neukum , James Hilliard , linux-usb@vger.kernel.org CC: Johan Hovold , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Russ Dill From: "Hector Martin \"marcan\"" Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On September 10, 2020 12:02:34 PM GMT+09:00, Oliver Neukum wrote: >Am Mittwoch, den 09.09.2020, 13:34 -0600 schrieb James Hilliard: >> This patch detects and reverses the effects of the malicious FTDI >> Windows driver version 2.12.00(FTDIgate). > >Hi, > >this raises questions. >Should we do this unconditionally without asking? >Does this belong into kernel space? I agree; this is very cute, but does it really need to be an automatic Linux feature? Presumably someone looking to fix a bricked FTDI chip can just run my script, and those who just want to use those chips with Linux already can since the driver binds to the zero PID. I am deeply amused by the idea of Linux automatically fixing problems caused by malicious Windows drivers, but thinking objectively, I'm not sure if that's the right thing to do. > >> +static int ftdi_repair_brick(struct usb_serial_port *port) >> +{ >> + struct ftdi_private *priv = usb_get_serial_port_data(port); >> + int orig_latency; >> + int rv; >> + u16 *eeprom_data; >> + u16 checksum; >> + int eeprom_size; >> + int result; >> + >> + switch (priv->chip_type) { >> + case FT232RL: >> + eeprom_size = 0x40; >> + break; >> + default: >> + /* Unsupported for brick repair */ >> + return 0; >> + } >> + >> + /* Latency timer needs to be 0x77 to unlock EEPROM programming */ >> + if (priv->latency != 0x77) { >> + orig_latency = priv->latency; >> + priv->latency = 0x77; >> + rv = write_latency_timer(port); >> + priv->latency = orig_latency; >> + if (rv < 0) >> + return -EIO; >> + } > >Do you really want to change this without returning to the original? > > Regards > Oliver -- Hector Martin "marcan" (hector@marcansoft.com) Public key: https://mrcn.st/pub