[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100105121059.GC10442@localhost>
Date: Tue, 5 Jan 2010 13:10:59 +0100
From: Johan Hovold <jhovold@...il.com>
To: Stefani Seibold <stefani@...bold.net>
Cc: Johan Hovold <jhovold@...il.com>,
Pete Zaitcev <zaitcev@...hat.com>, Greg KH <greg@...ah.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: USB: serial: kfifo_len locking
> > Here's the change. The fifo used to be protected by a lock, but is no
> > longer.
>
> I posted yesterday a patch to this thread. It would be great if you read
> and check this patch before complaining again!!!!
>
> > Never say you did.
>
> Sorry, i had no real idea what is your problem, if this is not what you
> want. As i mentioned i posted to you yesterday a fix for the possible
> kfifo_len() bug, but i didn't get a response if this is fixing your
> problem. Again the patch:
>
> diff -u -N -r -p linux-2.6.33-rc2.orig/drivers/usb/serial/generic.c linux-2.6.33-rc2.new/drivers/usb/serial/generic.c
> --- linux-2.6.33-rc2.orig/drivers/usb/serial/generic.c 2009-12-27 23:37:03.566060210 +0100
> +++ linux-2.6.33-rc2.new/drivers/usb/serial/generic.c 2010-01-04 20:15:38.023351711 +0100
> @@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(s
>
> dbg("%s - port %d", __func__, port->number);
>
> - if (serial->type->max_in_flight_urbs) {
> - spin_lock_irqsave(&port->lock, flags);
> + spin_lock_irqsave(&port->lock, flags);
> + if (serial->type->max_in_flight_urbs)
> chars = port->tx_bytes_flight;
> - spin_unlock_irqrestore(&port->lock, flags);
> - } else if (serial->num_bulk_out)
> + else if (serial->num_bulk_out)
> chars = kfifo_len(&port->write_fifo);
> + spin_unlock_irqrestore(&port->lock, flags);
>
> dbg("%s - returns %d", __func__, chars);
> return chars;
>
> This patch should solve the possible race (if there is one). With this
> patch all kfifo_... access are locked by the port->lock spinlock. If
> this is what you want i will posted it as a bug fix to andrew.
Yes, please do.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists