dibusb-common.c FE_HAS_LOCK problem

Message ID alpine.LRH.2.00.0911231418350.14263@pub1.ifh.de (mailing list archive)
State Superseded, archived
Headers

Commit Message

Patrick Boettcher Nov. 23, 2009, 1:19 p.m. UTC
  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:
>> [<ffffffffa0042292>] ? dibusb_i2c_xfer+0xe2/0x130 [dvb_usb_dibusb_common]
>> [<ffffffff81341dc1>] ? i2c_transfer+0x91/0xe0
>> [<ffffffffa0059081>] ? dib3000_write_reg+0x51/0x70 [dib3000mb]
>> [<ffffffffa00855c9>] ? 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 <email>

The patch attached.

--

Patrick Boettcher - Kernel Labs
http://www.kernellabs.com/
  

Comments

Mario Bachmann Nov. 23, 2009, 1:41 p.m. UTC | #1
Am Mon, 23 Nov 2009 14:19:10 +0100 (CET)
schrieb Patrick Boettcher <pboettcher@kernellabs.com>:

> 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:
> >> [<ffffffffa0042292>] ? dibusb_i2c_xfer+0xe2/0x130 [dvb_usb_dibusb_common]
> >> [<ffffffff81341dc1>] ? i2c_transfer+0x91/0xe0
> >> [<ffffffffa0059081>] ? dib3000_write_reg+0x51/0x70 [dib3000mb]
> >> [<ffffffffa00855c9>] ? 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 <email>
> 
> The patch attached.
> 
> --
> 
> Patrick Boettcher - Kernel Labs
> http://www.kernellabs.com/

Hi Patrick, 

your patch [dibusb-common-fix  text/PLAIN (1054 bytes)] works here. 

Tested-by: Mario Bachmann <grafgrimm77@gmx.de>

Mario
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

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);