From patchwork Mon Nov 23 13:19:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Boettcher X-Patchwork-Id: 2163 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 23 Nov 2009 13:19:19 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Mon, 23 Nov 2009 11:19:33 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NCYp5-0000Bl-IY; Mon, 23 Nov 2009 13:19:19 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757294AbZKWNTL (ORCPT + 1 other); Mon, 23 Nov 2009 08:19:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757290AbZKWNTL (ORCPT ); Mon, 23 Nov 2009 08:19:11 -0500 Received: from znsun1.ifh.de ([141.34.1.16]:42824 "EHLO znsun1.ifh.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757238AbZKWNTK (ORCPT ); Mon, 23 Nov 2009 08:19:10 -0500 Received: from pub1.ifh.de (pub1.ifh.de [141.34.15.191]) by znsun1.ifh.de (8.12.11.20060614/8.12.11) with ESMTP id nANDJAwx018456; Mon, 23 Nov 2009 14:19:10 +0100 (MET) Received: by pub1.ifh.de (Postfix, from userid 11503) id 5C841200066; Mon, 23 Nov 2009 14:19:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by pub1.ifh.de (Postfix) with ESMTP id 420291F0186; Mon, 23 Nov 2009 14:19:10 +0100 (CET) Date: Mon, 23 Nov 2009 14:19:10 +0100 (CET) From: Patrick Boettcher X-X-Sender: pboettch@pub1.ifh.de To: grafgrimm77@gmx.de cc: Linux Media Mailing List Subject: Re: dibusb-common.c FE_HAS_LOCK problem In-Reply-To: Message-ID: References: <20091107105614.7a51f2f5@x2.grafnetz> <20091121182514.61b39d23@x2.grafnetz> <20091123120310.5b10c9cc@x2.grafnetz> <20091123123338.7273255b@x2.grafnetz> User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 X-Spam-Report: ALL_TRUSTED,AWL,BAYES_00 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Mon, 23 Nov 2009, Patrick Boettcher wrote: > On Mon, 23 Nov 2009, grafgrimm77@gmx.de wrote: >> [..] >> ----- hello stupid I2C access ---- >> Pid: 255, comm: khubd Tainted: P A 2.6.31.6 #1 >> Call Trace: >> [] ? dibusb_i2c_xfer+0xe2/0x130 [dvb_usb_dibusb_common] >> [] ? i2c_transfer+0x91/0xe0 >> [] ? dib3000_write_reg+0x51/0x70 [dib3000mb] >> [] ? dvb_pll_attach+0xa9/0x238 [dvb_pll] >> [..] > > Voila. > > This is the access with makes the dvb-pll-driver not create the tuner driver. > > This is (I forgot the correct name) read-without-write-i2caccess. It is bad > handled by the dibusb-driver and it can destroy the eeprom on the USB side. > > Please try whether the attached patch fixes the whole situation for you. > > If so, please send back a line like this: > > Tested-by: Your name The patch attached. Tested-by: Mario Bachmann --- Patrick Boettcher - Kernel Labs http://www.kernellabs.com/ diff -r 52da57b5e800 linux/drivers/media/dvb/dvb-usb/dibusb-common.c --- a/linux/drivers/media/dvb/dvb-usb/dibusb-common.c Thu Nov 19 17:15:37 2009 +0100 +++ b/linux/drivers/media/dvb/dvb-usb/dibusb-common.c Mon Nov 23 13:20:10 2009 +0100 @@ -142,8 +142,13 @@ } else if ((msg[i].flags & I2C_M_RD) == 0) { if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0) break; - } else - break; + } else if (msg[i].addr != 0x50) { + /* 0x50 is the address of the eeprom - we need to protect it + * from dibusb's bad i2c implementation: reads without + * writing the offset before are forbidden */ + if (dibusb_i2c_msg(d, msg[i].addr, NULL, 0, msg[i].buf, msg[i].len) < 0) + break; + } } mutex_unlock(&d->i2c_mutex);