From: Duncan Sands <baldrick@wanadoo.fr>
To: linux-usb-devel@lists.sourceforge.net
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] USB speedtouch: eliminate ATM open/close races
Date: Tue, 25 Mar 2003 10:31:50 +0100 [thread overview]
Message-ID: <200303251031.50691.baldrick@wanadoo.fr> (raw)
The list of open vccs is modified by open/close, and traversed by the
receive tasklet. This is the last race I know of in this driver.
speedtch.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c Tue Mar 25 10:27:35 2003
+++ b/drivers/usb/misc/speedtch.c Tue Mar 25 10:27:35 2003
@@ -933,11 +933,17 @@
if (vcc->qos.aal != ATM_AAL5)
return -EINVAL;
- if (udsl_find_vcc (instance, vpi, vci))
+ down (&instance->serialize); /* vs self, udsl_atm_close */
+
+ if (udsl_find_vcc (instance, vpi, vci)) {
+ up (&instance->serialize);
return -EADDRINUSE;
+ }
- if (!(new = kmalloc (sizeof (struct udsl_vcc_data), GFP_KERNEL)))
+ if (!(new = kmalloc (sizeof (struct udsl_vcc_data), GFP_KERNEL))) {
+ up (&instance->serialize);
return -ENOMEM;
+ }
memset (new, 0, sizeof (struct udsl_vcc_data));
new->vcc = vcc;
@@ -949,12 +955,16 @@
vcc->vpi = vpi;
vcc->vci = vci;
+ tasklet_disable (&instance->receive_tasklet);
list_add (&new->list, &instance->vcc_list);
+ tasklet_enable (&instance->receive_tasklet);
set_bit (ATM_VF_ADDR, &vcc->flags);
set_bit (ATM_VF_PARTIAL, &vcc->flags);
set_bit (ATM_VF_READY, &vcc->flags);
+ up (&instance->serialize);
+
dbg ("Allocated new SARLib vcc 0x%p with vpi %d vci %d", new, vpi, vci);
MOD_INC_USE_COUNT;
@@ -983,7 +993,11 @@
udsl_cancel_send (instance, vcc);
+ down (&instance->serialize); /* vs self, udsl_atm_open */
+
+ tasklet_disable (&instance->receive_tasklet);
list_del (&vcc_data->list);
+ tasklet_enable (&instance->receive_tasklet);
if (vcc_data->reasBuffer)
kfree_skb (vcc_data->reasBuffer);
@@ -997,6 +1011,8 @@
clear_bit (ATM_VF_READY, &vcc->flags);
clear_bit (ATM_VF_PARTIAL, &vcc->flags);
clear_bit (ATM_VF_ADDR, &vcc->flags);
+
+ up (&instance->serialize);
MOD_DEC_USE_COUNT;
next reply other threads:[~2003-03-25 9:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-25 9:31 Duncan Sands [this message]
2003-03-25 19:33 ` 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=200303251031.50691.baldrick@wanadoo.fr \
--to=baldrick@wanadoo.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®