From: "H . J . Lu" <hjl@lucon.org>
To: Kristian Hogsberg <hogsberg@users.sourceforge.net>
Cc: Andrew Morton <akpm@zip.com.au>,
hogsberg@users.sourceforge.net, jamesg@filanet.com,
linux-1394devel@lists.sourceforge.net,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: sbp2.c on SMP
Date: Fri, 16 Nov 2001 13:25:20 -0800 [thread overview]
Message-ID: <20011116132520.A6204@lucon.org> (raw)
In-Reply-To: <3BEF27D1.7793AE8E@zip.com.au> <3BEF27D1.7793AE8E@zip.com.au> <20011113191721.A9276@lucon.org> <3BF21B79.5F188A0D@zip.com.au> <20011115193234.A22081@lucon.org> <m3snbeofnw.fsf@dk20037170.bang-olufsen.dk>
In-Reply-To: <m3snbeofnw.fsf@dk20037170.bang-olufsen.dk>; from hogsberg@users.sf.net on Fri, Nov 16, 2001 at 05:15:47PM +0100
On Fri, Nov 16, 2001 at 05:15:47PM +0100, Kristian Hogsberg wrote:
> This is true, but only because the struct list_head is the first
> element in struct node_entry. If it wasn't, lh would have been -16 or
> so, as Andrew says.
>
> In any case, it's the wrong fix, because the error is elsewhere:
> neither the host_info list or the node list should contain NULL
> entries. This is just curing the symptoms. HJ, could you provide
> some details on the crash? Do you have the sbp2 module loaded when
> you insmod/rmmod ohci1394, and if so, does it crash without sbp2
> loaded?
>
Found it. You have to use list_for_each_safe when you remove things.
Here is a patch.
H.J.
----
--- linux-2.4.9-12.2mod/drivers/ieee1394/nodemgr.c.rmmod Tue Nov 13 19:15:44 2001
+++ linux-2.4.9-12.2mod/drivers/ieee1394/nodemgr.c Fri Nov 16 13:14:22 2001
@@ -558,7 +558,7 @@ done_reset_host:
static void nodemgr_remove_host(struct hpsb_host *host)
{
- struct list_head *lh;
+ struct list_head *lh, *spare;
struct host_info *hi = NULL;
struct node_entry *ne;
unsigned long flags;
@@ -568,7 +568,7 @@ static void nodemgr_remove_host(struct h
/* First remove all node entries for this host */
write_lock_irqsave(&node_lock, flags);
- list_for_each(lh, &node_list) {
+ list_for_each_safe(lh, spare, &node_list) {
ne = list_entry(lh, struct node_entry, list);
/* Only checking this host */
--- linux-2.4.9-12.2mod/drivers/ieee1394/sbp2.c.rmmod Thu Nov 15 17:08:49 2001
+++ linux-2.4.9-12.2mod/drivers/ieee1394/sbp2.c Fri Nov 16 13:14:37 2001
@@ -754,13 +754,13 @@ static int sbp2util_create_command_orb_p
static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_id,
struct sbp2scsi_host_info *hi)
{
- struct list_head *lh;
+ struct list_head *lh, *spare;
struct sbp2_command_info *command;
unsigned long flags;
sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_completed)) {
- list_for_each(lh, &scsi_id->sbp2_command_orb_completed) {
+ list_for_each_safe(lh, spare, &scsi_id->sbp2_command_orb_completed) {
command = list_entry(lh, struct sbp2_command_info, list);
/* Release our generic DMA's */
--- linux-2.4.9-12.2mod/drivers/ieee1394/video1394.c.rmmod Sun Nov 11 21:06:48 2001
+++ linux-2.4.9-12.2mod/drivers/ieee1394/video1394.c Fri Nov 16 13:15:28 2001
@@ -1592,7 +1592,7 @@ static void video1394_remove_host (struc
{
struct ti_ohci *ohci;
unsigned long flags;
- struct list_head *lh;
+ struct list_head *lh, *spare;
/* We only work with the OHCI-1394 driver */
if (strcmp(host->template->name, OHCI1394_DRIVER_NAME))
@@ -1603,7 +1603,7 @@ static void video1394_remove_host (struc
spin_lock_irqsave(&video1394_cards_lock, flags);
if (!list_empty(&video1394_cards)) {
struct video_card *p;
- list_for_each(lh, &video1394_cards) {
+ list_for_each_safe(lh, spare, &video1394_cards) {
p = list_entry(lh, struct video_card, list);
if (p ->ohci == ohci) {
remove_card(p);
next prev parent reply other threads:[~2001-11-16 21:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-12 1:37 sbp2.c on SMP Andrew Morton
2001-11-12 4:54 ` H . J . Lu
2001-11-12 5:14 ` Andrew Morton
2001-11-12 5:28 ` H . J . Lu
2001-11-12 8:50 ` Alan Cox
2001-11-12 17:34 ` Jens Axboe
2001-11-14 3:17 ` H . J . Lu
2001-11-14 7:21 ` Andrew Morton
2001-11-16 3:32 ` H . J . Lu
2001-11-16 16:15 ` Kristian Hogsberg
2001-11-16 16:30 ` H . J . Lu
2001-11-16 21:25 ` H . J . Lu [this message]
2001-11-16 22:40 ` Kristian Hogsberg
2001-11-26 15:43 ` Oops 2.4.15-pre1aa1 Sven Heinicke
-- strict thread matches above, loose matches on Subject: below --
2001-11-12 4:49 sbp2.c on SMP Douglas Gilbert
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=20011116132520.A6204@lucon.org \
--to=hjl@lucon.org \
--cc=akpm@zip.com.au \
--cc=hogsberg@users.sourceforge.net \
--cc=jamesg@filanet.com \
--cc=linux-1394devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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.