lkml.org 
[lkml]   [2012]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: your mail
On 02/12/2012 08:11 PM, Al Viro wrote:
> On Sun, Feb 12, 2012 at 01:21:10AM +0100, Richard Weinberger wrote:
>
>> @@ -343,7 +267,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
>> {
>> struct chan *chan = data;
>> struct line *line = chan->line;
>> - struct tty_struct *tty = line->tty;
>> + struct tty_struct *tty = tty_port_tty_get(&line->port);
>> int err;
>>
>> /*
>> @@ -354,6 +278,9 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
>> spin_lock(&line->lock);
>> err = flush_buffer(line);
>> if (err == 0) {
>> + tty_kref_put(tty);
>> +
>> + spin_unlock(&line->lock);
>> return IRQ_NONE;
>> } else if (err < 0) {
>> line->head = line->buffer;
>> @@ -365,9 +292,12 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
>> return IRQ_NONE;
>>
>> tty_wakeup(tty);
>> + tty_kref_put(tty);
>> return IRQ_HANDLED;
>> }
>
> That, BTW, smells ugly. Note that return before the last one has no
> tty_kref_put() for a very good reason - it's under if (!tty). And
> just as line->tty, port->tty can become NULL, so tty_port_tty_get()
> can, indeed, return NULL here. Which makes the first tty_kref_put()
> oopsable...

Nope, it is allowed to call tty_kref_put(NULL).

regards,
--
js
suse labs


\
 
 \ /
  Last update: 2012-02-13 10:19    [W:0.064 / U:0.116 seconds]
©2003-2014 Jasper Spaans. Advertise on this site