<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers, branch v2.6.16.49</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers?h=v2.6.16.49</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers?h=v2.6.16.49'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2007-04-20T22:18:01Z</updated>
<entry>
<title>tty_io: fix race in master pty close/slave pty close path</title>
<updated>2007-04-20T22:18:01Z</updated>
<author>
<name>Aristeu Sergio Rozanski Filho</name>
<email>aris@ruivo.org</email>
</author>
<published>2007-04-20T22:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fec2411aa963fafcf17823b43c2379ba3d228cd8'/>
<id>urn:sha1:fec2411aa963fafcf17823b43c2379ba3d228cd8</id>
<content type='text'>
This patch fixes a possible race that leads to double freeing an idr index.
 When the master begin to close, release_dev() is called and then
pty_close() is called:

        if (tty-&gt;driver-&gt;close)
                tty-&gt;driver-&gt;close(tty, filp);

This is done without helding any locks other than BKL.  Inside pty_close(),
being a master close, the devpts entry will be removed:

#ifdef CONFIG_UNIX98_PTYS
                if (tty-&gt;driver == ptm_driver)
                        devpts_pty_kill(tty-&gt;index);
#endif

But devpts_pty_kill() will call get_node() that may sleep while waiting for
&amp;devpts_root-&gt;d_inode-&gt;i_sem.  When this happens and the slave is being
opened, tty_open() just found the driver and index:

        driver = get_tty_driver(device, &amp;index);
        if (!driver) {
                mutex_unlock(&amp;tty_mutex);
                return -ENODEV;
        }

This part of the code is already protected under tty_mute.  The problem is
that the slave close already got an index.  Then init_dev() is called and
blocks waiting for the same &amp;devpts_root-&gt;d_inode-&gt;i_sem.

When the master close resumes, it removes the devpts entry, and the
relation between idr index and the tty is gone.  The master then sleeps
waiting for the tty_mutex on release_dev().

Slave open resumes and found no tty for that index.  As result, a NULL tty
is returned and init_dev() doesn't flow to fast_track:

        /* check whether we're reopening an existing tty */
        if (driver-&gt;flags &amp; TTY_DRIVER_DEVPTS_MEM) {
                tty = devpts_get_tty(idx);
                if (tty &amp;&amp; driver-&gt;subtype == PTY_TYPE_MASTER)
                        tty = tty-&gt;link;
        } else {
                tty = driver-&gt;ttys[idx];
        }
        if (tty) goto fast_track;

The result of this, is that a new tty will be created and init_dev() returns
sucessfull. After returning, tty_mutex is dropped and master close may resume.

Master close finds it's the only use and both sides are closing, then releases
the tty and the index. At this point, the idr index is free, but slave still
has it.

Slave open then calls pty_open() and finds that tty-&gt;link-&gt;count is 0,
because there's no master and returns error.  Then tty_open() calls
release_dev() which executes without any warning, as it was a case of last
slave close when the master is already closed (master-&gt;count == 0,
slave-&gt;count == 1).  The tty is then released with the already released idr
index.

This normally would only issue a warning on idr_remove() but in case of a
customer's critical application, it's never too simple:

thread1: opens master, gets index X
thread1: begin closing master
thread2: begin opening slave with index X
thread1: finishes closing master, index X released
thread3: opens master, gets index X, just released
thread2: fails opening slave, releases index X         &lt;----
thread4: opens master, gets index X, init_dev() then find an already in use
         and healthy tty and fails

If no more indexes are released, ptmx_open() will keep failing, as the
first free index available is X, and it will make init_dev() fail because
you're trying to "reopen a master" which isn't valid.

The patch notices when this race happens and make init_dev() fail
imediately.  The init_dev() function is called with tty_mutex held, so it's
safe to continue with tty till the end of function because release_dev()
won't make any further changes without grabbing the tty_mutex.

Without the patch, on some machines it's possible get easily idr warnings
like this one:

idr_remove called for id=15 which is not allocated.
 [&lt;c02555b9&gt;] idr_remove+0x139/0x170
 [&lt;c02a1b62&gt;] release_mem+0x182/0x230
 [&lt;c02a28e7&gt;] release_dev+0x4b7/0x700
 [&lt;c02a0ea7&gt;] tty_ldisc_enable+0x27/0x30
 [&lt;c02a1e64&gt;] init_dev+0x254/0x580
 [&lt;c02a0d64&gt;] check_tty_count+0x14/0xb0
 [&lt;c02a4f05&gt;] tty_open+0x1c5/0x340
 [&lt;c02a4d40&gt;] tty_open+0x0/0x340
 [&lt;c017388f&gt;] chrdev_open+0xaf/0x180
 [&lt;c017c2ac&gt;] open_namei+0x8c/0x760
 [&lt;c01737e0&gt;] chrdev_open+0x0/0x180
 [&lt;c0167bc9&gt;] __dentry_open+0xc9/0x210
 [&lt;c0167e2c&gt;] do_filp_open+0x5c/0x70
 [&lt;c0167a91&gt;] get_unused_fd+0x61/0xd0
 [&lt;c0167e93&gt;] do_sys_open+0x53/0x100
 [&lt;c0167f97&gt;] sys_open+0x27/0x30
 [&lt;c010303b&gt;] syscall_call+0x7/0xb

using this test application available on:
 http://www.ruivo.org/~aris/pty_sodomizer.c

Signed-off-by: Aristeu Sergio Rozanski Filho &lt;aris@ruivo.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>hwmon/w83627ehf: Fix the fan5 clock divider write</title>
<updated>2007-04-19T23:43:12Z</updated>
<author>
<name>Jean Delvare</name>
<email>khali@linux-fr.org</email>
</author>
<published>2007-04-19T23:43:12Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=17acc02c4df45426d62e5e31231a2312c361f107'/>
<id>urn:sha1:17acc02c4df45426d62e5e31231a2312c361f107</id>
<content type='text'>
Users have been complaining about the w83627ehf driver flooding their logs
with debug messages like:

w83627ehf 9191-0a10: Increasing fan 4 clock divider from 64 to 128

or:

w83627ehf 9191-0290: Increasing fan 4 clock divider from 4 to 8

The reason is that we failed to actually write the LSB of the encoded clock
divider value for that fan, causing the next read to report the same old value
again and again.

Additionally, the fan number was improperly reported, making the bug harder to
find.

Signed-off-by: Jean Delvare &lt;khali@linux-fr.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>[SCSI] QLOGICPTI: Do not unmap DMA unless we actually mapped something.</title>
<updated>2007-04-19T23:31:17Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2007-04-19T23:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ad65d701caf0937add48e1c54263850a6a382d27'/>
<id>urn:sha1:ad65d701caf0937add48e1c54263850a6a382d27</id>
<content type='text'>
We only map DMA when cmd-&gt;request_bufflen is non-zero for non-sg
buffers, we thus should make the same check when unmapping.

Based upon a report from Pasi Pirhonen.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>V4L/DVB: Pluto2: fix incorrect TSCR register setting</title>
<updated>2007-04-13T20:58:25Z</updated>
<author>
<name>Andreas Oberritter</name>
<email>obi@linuxtv.org</email>
</author>
<published>2007-04-13T19:21:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2530ba1f3a6ea7923979907715fe00a7e4b2c818'/>
<id>urn:sha1:2530ba1f3a6ea7923979907715fe00a7e4b2c818</id>
<content type='text'>
The ADEF bits in the TSCR register have different meanings in read and
write mode. For this reason ADEF has to be reset on every
read-modify-write operation.
This patch introduces a special write function for this register, which
takes care of it.

Thanks to Holger Magnussen for pointing my nose at this problem.

Signed-off-by: Andreas Oberritter &lt;obi@linuxtv.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>V4L: radio: Fix error in Kbuild file</title>
<updated>2007-04-13T20:58:24Z</updated>
<author>
<name>Trent Piepho</name>
<email>xyzzy@speakeasy.org</email>
</author>
<published>2007-04-13T19:23:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9c38858ad17d961762deb032d7e9737589cae3a2'/>
<id>urn:sha1:9c38858ad17d961762deb032d7e9737589cae3a2</id>
<content type='text'>
All the radio drivers need video_dev, but they were depending on
VIDEO_DEV!=n.  That meant that one could try to compile the driver into
the kernel when VIDEO_DEV=m, which will not work.  If video_dev is a
module, then the radio drivers must be modules too.

(cherry picked from commit b10fece583fdfdb3d2f29b0da3896ec58b8fe122)

Signed-off-by: Trent Piepho &lt;xyzzy@speakeasy.org&gt;
Signed-off-by: Michael Krufky &lt;mkrufky@linuxtv.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>V4L: tveeprom: autodetect LG TAPC G701D as tuner type 37</title>
<updated>2007-04-13T20:58:24Z</updated>
<author>
<name>Michael Krufky</name>
<email>mkrufky@linuxtv.org</email>
</author>
<published>2007-04-13T19:18:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1a40c3a4c890b95b66a8831aa967cd12cef61062'/>
<id>urn:sha1:1a40c3a4c890b95b66a8831aa967cd12cef61062</id>
<content type='text'>
Autodetect LG TAPC G701D as tuner type 37, fixing
mis-detected tuners in some Hauppauge tv tuner cards.

Thanks to Adonis Papas, for pointing this out.

(cherry picked from commit 1323fbda1343f50f198bc8bd6d1d59c8b7fc45bf)

Signed-off-by: Michael Krufky &lt;mkrufky@linuxtv.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>sky2: turn on clocks when doing resume</title>
<updated>2007-04-13T20:58:24Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@linux-foundation.org</email>
</author>
<published>2007-04-13T18:34:00Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d9b258c4bcf11ec912d95c8e61d7453b07f28c63'/>
<id>urn:sha1:d9b258c4bcf11ec912d95c8e61d7453b07f28c63</id>
<content type='text'>
Some of these chips are disabled until clock is enabled.
This fixes:
     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=404107

Signed-off-by: Stephen Hemminger &lt;shemminger@linux-foundation.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>sky2: turn carrier off when down</title>
<updated>2007-04-13T20:58:23Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@linux-foundation.org</email>
</author>
<published>2007-04-13T18:32:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e3bfdc5b2a5a2f4429e2bcd9123a39a361c18662'/>
<id>urn:sha1:e3bfdc5b2a5a2f4429e2bcd9123a39a361c18662</id>
<content type='text'>
Driver needs to turn off carrier when down.

Signed-off-by: Stephen Hemminger &lt;shemminger@linux-foundation.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>skge: turn carrier off when down</title>
<updated>2007-04-13T20:58:23Z</updated>
<author>
<name>Stephen Hemminger</name>
<email>shemminger@linux-foundation.org</email>
</author>
<published>2007-04-13T18:31:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=35688b92b2b447cee8f9923fd462c6cd216b695e'/>
<id>urn:sha1:35688b92b2b447cee8f9923fd462c6cd216b695e</id>
<content type='text'>
Driver needs to turn off carrier when down, otherwise it can
confuse bonding and bridging and looks like carrier is on immediately
when it is brought back up.

Signed-off-by: Stephen Hemminger &lt;shemminger@linux-foundation.org&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
<entry>
<title>r8169: issue request_irq after the private data are completely initialized</title>
<updated>2007-04-13T20:57:48Z</updated>
<author>
<name>Francois Romieu</name>
<email>romieu@fr.zoreil.com</email>
</author>
<published>2007-04-13T20:57:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1ee709383b60148263f139af790c8b5a22c2e586'/>
<id>urn:sha1:1ee709383b60148263f139af790c8b5a22c2e586</id>
<content type='text'>
The irq handler schedules a NAPI poll request unconditionally as soon as
the status register is not clean. It has been there - and wrong - for
ages but a recent timing change made it apparently easier to trigger.

Adrian Bunk:
backported to 2.6.16

Signed-off-by: Francois Romieu &lt;romieu@fr.zoreil.com&gt;
Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
</content>
</entry>
</feed>
