All of lore.kernel.org
 help / color / mirror / Atom feed
From: J <jhnlmn@yahoo.com>
To: Oliver Neukum <oliver@neukum.org>, Greg KH <gregkh@suse.de>
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: Possible race condition in usb-serial.c
Date: Fri, 22 Dec 2006 11:08:00 -0800 (PST)	[thread overview]
Message-ID: <20061222190800.3167.qmail@web32909.mail.mud.yahoo.com> (raw)
In-Reply-To: <200612221914.41111.oliver@neukum.org>

> This problem will need some deeper surgery probably
> involving
> removal of the refcounting.

Refcounting may be OK if used consistently. 
It is not OK when some pointers are ref-counted, 
but other (in serial_table) are not (like it is
in the current version).

As for the deeper surgery, what do you think about my
earlier suggestion to start by rewriting
usb_serial_probe
to fully initialize usb_serial before it is added to 
serial_table? 

So, instead of the current:
1. create_serial
...
2. mutex_lock(&table_lock);
3. get_free_serial (which inserts serial to
serial_table)
...
4. initializes serial
5. mutex_unlock(&table_lock);

we will get:

1. create_serial
2. initializes serial

3. add_serial_toserial_table  (with internal mutex
lock if needed)

Similar approach should be used in other places to
minimize the code executed under the mutex.

John

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

  reply	other threads:[~2006-12-22 19:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 19:21 Possible race condition in usb-serial.c J
2006-12-19 20:15 ` Oliver Neukum
2006-12-19 22:33   ` J
2006-12-20  9:47     ` Oliver Neukum
2006-12-20 15:10       ` [linux-usb-devel] " Alan Stern
2006-12-20 21:02         ` Oliver Neukum
2006-12-20 19:32       ` J
2006-12-20 20:43         ` Oliver Neukum
2006-12-20 22:24           ` J
2006-12-22 18:14             ` Oliver Neukum
2006-12-22 19:08               ` J [this message]
2006-12-22 19:59                 ` Oliver Neukum
2006-12-22 20:51                   ` J
2006-12-20 20:43         ` Greg KH
2006-12-20 22:39           ` J
2006-12-20 22:52             ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061222190800.3167.qmail@web32909.mail.mud.yahoo.com \
    --to=jhnlmn@yahoo.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oliver@neukum.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.