<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/char, branch v2.6.32.29</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/char?h=v2.6.32.29</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/char?h=v2.6.32.29'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2011-02-17T23:37:11Z</updated>
<entry>
<title>tpm_tis: Use timeouts returned from TPM</title>
<updated>2011-02-17T23:37:11Z</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.vnet.ibm.com</email>
</author>
<published>2011-01-11T19:37:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=25e442e2eacdc1bc8fadcd895aa40aaaf66164d3'/>
<id>urn:sha1:25e442e2eacdc1bc8fadcd895aa40aaaf66164d3</id>
<content type='text'>
commit 9b29050f8f75916f974a2d231ae5d3cd59792296 upstream.

The current TPM TIS driver in git discards the timeout values returned
from the TPM. The check of the response packet needs to consider that
the return_code field is 0 on success and the size of the expected
packet is equivalent to the header size + u32 length indicator for the
TPM_GetCapability() result + 3 timeout indicators of type u32.

I am also adding a sysfs entry 'timeouts' showing the timeouts that are
being used.

Signed-off-by: Stefan Berger &lt;stefanb@linux.vnet.ibm.com&gt;
Tested-by: Guillaume Chazarain &lt;guichaz@gmail.com&gt;
Signed-off-by: Rajiv Andrade &lt;srajiv@linux.vnet.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>TPM: Long default timeout fix</title>
<updated>2011-02-17T23:37:11Z</updated>
<author>
<name>Rajiv Andrade</name>
<email>srajiv@linux.vnet.ibm.com</email>
</author>
<published>2010-11-12T21:30:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5718043736912b35b06b55a261c294a1e467b6e8'/>
<id>urn:sha1:5718043736912b35b06b55a261c294a1e467b6e8</id>
<content type='text'>
commit c4ff4b829ef9e6353c0b133b7adb564a68054979 upstream.

If duration variable value is 0 at this point, it's because
chip-&gt;vendor.duration wasn't filled by tpm_get_timeouts() yet.
This patch sets then the lowest timeout just to give enough
time for tpm_get_timeouts() to further succeed.

This fix avoids long boot times in case another entity attempts
to send commands to the TPM when the TPM isn't accessible.

Signed-off-by: Rajiv Andrade &lt;srajiv@linux.vnet.ibm.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>hvc_iucv: allocate memory buffers for IUCV in zone DMA</title>
<updated>2011-02-17T23:36:52Z</updated>
<author>
<name>Hendrik Brueckner</name>
<email>brueckner@linux.vnet.ibm.com</email>
</author>
<published>2010-03-08T11:25:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f3a234342aa4ceb45adf1e11c16b11fdb297300c'/>
<id>urn:sha1:f3a234342aa4ceb45adf1e11c16b11fdb297300c</id>
<content type='text'>
commit 91a970d9889c7d6f451ee91ed361d0f0119d3778 upstream.

The device driver must allocate memory for IUCV buffers with GFP_DMA,
because IUCV cannot address memory above 2GB (31bit addresses only).

Because the IUCV ignores the higher bits of the address, sending and
receiving IUCV data with this driver might cause memory corruptions.

Signed-off-by: Hendrik Brueckner &lt;brueckner@linux.vnet.ibm.com&gt;
Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: maximilian attems &lt;max@stro.at&gt;

</content>
</entry>
<entry>
<title>hvc_console: Fix race between hvc_close and hvc_remove, again</title>
<updated>2011-01-07T22:43:12Z</updated>
<author>
<name>Anton Blanchard</name>
<email>anton@samba.org</email>
</author>
<published>2010-04-06T11:42:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ec955e326e90b693011f6429b4cc0a72fe795168'/>
<id>urn:sha1:ec955e326e90b693011f6429b4cc0a72fe795168</id>
<content type='text'>
commit 320718ee074acce5ffced6506cb51af1388942aa upstream.

I don't claim to understand the tty layer, but it seems like hvc_open and
hvc_close should be balanced in their kref reference counting.

Right now we get a kref every call to hvc_open:

        if (hp-&gt;count++ &gt; 0) {
                tty_kref_get(tty); &lt;----- here
                spin_unlock_irqrestore(&amp;hp-&gt;lock, flags);
                hvc_kick();
                return 0;
        } /* else count == 0 */

        tty-&gt;driver_data = hp;

        hp-&gt;tty = tty_kref_get(tty); &lt;------ or here if hp-&gt;count was 0

But hvc_close has:

        tty_kref_get(tty);

        if (--hp-&gt;count == 0) {
...
                /* Put the ref obtained in hvc_open() */
                tty_kref_put(tty);
...
        }

        tty_kref_put(tty);

Since the outside kref get/put balance we only do a single kref_put when
count reaches 0.

The patch below changes things to call tty_kref_put once for every
hvc_close call, and with that my machine boots fine.

Signed-off-by: Anton Blanchard &lt;anton@samba.org&gt;
Acked-by: Amit Shah &lt;amit.shah@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>hvc_console: Fix race between hvc_close and hvc_remove</title>
<updated>2011-01-07T22:43:12Z</updated>
<author>
<name>Amit Shah</name>
<email>amit.shah@redhat.com</email>
</author>
<published>2010-03-12T06:23:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ef5ce99dff0b45abd4563de36c0bc32ba00ae022'/>
<id>urn:sha1:ef5ce99dff0b45abd4563de36c0bc32ba00ae022</id>
<content type='text'>
commit e74d098c66543d0731de62eb747ccd5b636a6f4c upstream.

Alan pointed out a race in the code where hvc_remove is invoked. The
recent virtio_console work is the first user of hvc_remove().

Alan describes it thus:

The hvc_console assumes that a close and remove call can't occur at the
same time.

In addition tty_hangup(tty) is problematic as tty_hangup is asynchronous
itself....

So this can happen

        hvc_close                               hvc_remove
        hung up ? - no
                                                lock
                                                tty = hp-&gt;tty
                                                unlock
        lock
        hp-&gt;tty = NULL
        unlock
        notify del
        kref_put the hvc struct
        close completes
        tty is destroyed
                                                tty_hangup dead tty
                                                tty-&gt;ops will be NULL
                                                NULL-&gt;...

This patch adds some tty krefs and also converts to using tty_vhangup().

Reported-by: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Amit Shah &lt;amit.shah@redhat.com&gt;
CC: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
CC: linuxppc-dev@ozlabs.org
CC: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>TTY: Fix error return from tty_ldisc_open()</title>
<updated>2011-01-07T22:43:01Z</updated>
<author>
<name>Ben Hutchings</name>
<email>ben@decadent.org.uk</email>
</author>
<published>2010-12-11T05:51:39Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6db0ed1582b1eae8b1120de4494cafc9635fdc3f'/>
<id>urn:sha1:6db0ed1582b1eae8b1120de4494cafc9635fdc3f</id>
<content type='text'>
The backported version of "TTY: ldisc, fix open flag handling" in
2.6.32.27 causes tty_ldisc_open() to return 0 on error.  Fix that.

Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>TTY: ldisc, fix open flag handling</title>
<updated>2010-12-09T21:26:47Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2010-11-24T23:27:54Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=004e147bd32cda45140354ace87f55abed3b82cb'/>
<id>urn:sha1:004e147bd32cda45140354ace87f55abed3b82cb</id>
<content type='text'>
commit 7f90cfc505d613f4faf096e0d84ffe99208057d9 upstream.

When a concrete ldisc open fails in tty_ldisc_open, we forget to clear
TTY_LDISC_OPEN. This causes a false warning on the next ldisc open:
WARNING: at drivers/char/tty_ldisc.c:445 tty_ldisc_open+0x26/0x38()
Hardware name: System Product Name
Modules linked in: ...
Pid: 5251, comm: a.out Tainted: G        W  2.6.32-5-686 #1
Call Trace:
 [&lt;c1030321&gt;] ? warn_slowpath_common+0x5e/0x8a
 [&lt;c1030357&gt;] ? warn_slowpath_null+0xa/0xc
 [&lt;c119311c&gt;] ? tty_ldisc_open+0x26/0x38
 [&lt;c11936c5&gt;] ? tty_set_ldisc+0x218/0x304
...

So clear the bit when failing...

Introduced in c65c9bc3efa (tty: rewrite the ldisc locking) back in
2.6.31-rc1.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Reported-by: Sergey Lapin &lt;slapin@ossfans.org&gt;
Tested-by: Sergey Lapin &lt;slapin@ossfans.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tty_ldisc: Fix BUG() on hangup</title>
<updated>2010-12-09T21:26:47Z</updated>
<author>
<name>Philippe Rétornaz</name>
<email>philippe.retornaz@epfl.ch</email>
</author>
<published>2010-10-27T15:13:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d22ed6613136322b8cd6a126b75f5c8175f5f00c'/>
<id>urn:sha1:d22ed6613136322b8cd6a126b75f5c8175f5f00c</id>
<content type='text'>
commit 1c95ba1e1de7edffc0c4e275e147f1a9eb1f81ae upstream.

A kernel BUG when bluetooth rfcomm connection drop while the associated
serial port is open is sometime triggered.

It seems that the line discipline can disappear between the
tty_ldisc_put and tty_ldisc_get. This patch fall back to the N_TTY line
discipline if the previous discipline is not available anymore.

Signed-off-by: Philippe Retornaz &lt;philippe.retornaz@epfl.ch&gt;
Acked-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>TTY: restore tty_ldisc_wait_idle</title>
<updated>2010-12-09T21:26:47Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2010-10-31T22:17:51Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3fe5daa1d79cbd71c4b8eb7792ea339762399092'/>
<id>urn:sha1:3fe5daa1d79cbd71c4b8eb7792ea339762399092</id>
<content type='text'>
commit 100eeae2c5ce23b4db93ff320ee330ef1d740151 upstream.

It was removed in 65b770468e98 (tty-ldisc: turn ldisc user count into
a proper refcount), but we need to wait for last user to quit the
ldisc before we close it in tty_set_ldisc.

Otherwise weird things start to happen. There might be processes
waiting in tty_read-&gt;n_tty_read on tty-&gt;read_wait for input to appear
and at that moment, a change of ldisc is fatal. n_tty_close is called,
it frees read_buf and the waiting process is still in the middle of
reading and goes nuts after it is woken.

Previously we prevented close to happen when others are in ldisc ops
by tty_ldisc_wait_idle in tty_set_ldisc. But the commit above removed
that. So revoke the change and test whether there is 1 user (=we), and
allow the close then.

We can do that without ldisc/tty locks, because nobody else can open
the device due to TTY_LDISC_CHANGING bit set, so we in fact wait for
everybody to leave.

I don't understand why tty_ldisc_lock would be needed either when the
counter is an atomic variable, so this is a lockless
tty_ldisc_wait_idle.

On the other hand, if we fail to wait (timeout or signal), we have to
reenable the halted ldiscs, so we take ldisc lock and reuse the setup
path at the end of tty_set_ldisc.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Tested-by: Sebastian Andrzej Siewior &lt;bigeasy@breakpoint.cc&gt;
LKML-Reference: &lt;20101031104136.GA511@Chamillionaire.breakpoint.cc&gt;
LKML-Reference: &lt;1287669539-22644-1-git-send-email-jslaby@suse.cz&gt;
Cc: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>tty: prevent DOS in the flush_to_ldisc</title>
<updated>2010-12-09T21:26:46Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2010-11-08T18:01:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8dded7dc4c71fd206ffa2b7725a1c74544104009'/>
<id>urn:sha1:8dded7dc4c71fd206ffa2b7725a1c74544104009</id>
<content type='text'>
commit e045fec48970df84647a47930fcf7a22ff7229c0 upstream.

There's a small window inside the flush_to_ldisc function,
where the tty is unlocked and calling ldisc's receive_buf
function. If in this window new buffer is added to the tty,
the processing might never leave the flush_to_ldisc function.

This scenario will hog the cpu, causing other tty processing
starving, and making it impossible to interface the computer
via tty.

I was able to exploit this via pty interface by sending only
control characters to the master input, causing the flush_to_ldisc
to be scheduled, but never actually generate any output.

To reproduce, please run multiple instances of following code.

- SNIP
#define _XOPEN_SOURCE
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;fcntl.h&gt;

int main(int argc, char **argv)
{
        int i, slave, master = getpt();
        char buf[8192];

        sprintf(buf, "%s", ptsname(master));
        grantpt(master);
        unlockpt(master);

        slave = open(buf, O_RDWR);
        if (slave &lt; 0) {
                perror("open slave failed");
                return 1;
        }

        for(i = 0; i &lt; sizeof(buf); i++)
                buf[i] = rand() % 32;

        while(1) {
                write(master, buf, sizeof(buf));
        }

        return 0;
}
- SNIP

The attached patch (based on -next tree) fixes this by checking on the
tty buffer tail. Once it's reached, the current work is rescheduled
and another could run.

Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Acked-by: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
</feed>
