LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Hansjoerg Lipp <hjlipp@web.de>, Karsten Keil <kkeil@suse.de>,
Roland Kletzing <devzero@web.de>
Subject: [PATCH 2.6.25-rc4] gigaset: fix Oops on module unload regression
Date: Fri, 7 Mar 2008 19:47:08 +0100 (CET) [thread overview]
Message-ID: <20080307184708.C603F110055@xenon.ts.pxnet.com> (raw)
The card state mutex was only initialized when a device was connected,
but used during unload unconditionally, leading to an Oops if a driver
was loaded and unloaded again without ever connecting a device.
Fix this by initializing the mutex as soon as the structure is allocated.
Also add a missing mutex unlock revealed in the same execution path.
Thanks to Roland Kletzing for reporting this problem.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Tested-by: Roland Kletzing <devzero@web.de>
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: Karsten Keil <kkeil@suse.de>
---
This fixes a possible Oops in 2.6.25-rc that was introduced by commit
e468c04894f36045cf93d1384183a461014b6840 (Gigaset: permit module unload).
Please merge as a regression fix for 2.6.25.
drivers/isdn/gigaset/common.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index aacedec..827c32c 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -637,7 +637,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
err("maximum number of devices exceeded");
return NULL;
}
- mutex_init(&cs->mutex);
gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
@@ -898,8 +897,10 @@ int gigaset_shutdown(struct cardstate *cs)
{
mutex_lock(&cs->mutex);
- if (!(cs->flags & VALID_MINOR))
+ if (!(cs->flags & VALID_MINOR)) {
+ mutex_unlock(&cs->mutex);
return -1;
+ }
cs->waiting = 1;
@@ -1086,6 +1087,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
drv->cs[i].driver = drv;
drv->cs[i].ops = drv->ops;
drv->cs[i].minor_index = i;
+ mutex_init(&drv->cs[i].mutex);
}
gigaset_if_initdriver(drv, procname, devname);
--
1.5.4.7.gd8534-dirty
reply other threads:[~2008-03-07 18:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080307184708.C603F110055@xenon.ts.pxnet.com \
--to=tilman@imap.cc \
--cc=devzero@web.de \
--cc=hjlipp@web.de \
--cc=kkeil@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--subject='Re: [PATCH 2.6.25-rc4] gigaset: fix Oops on module unload regression' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).