lkml.org 
[lkml]   [2001]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: sbp2.c on SMP
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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:13    [from the cache]
©2003-2011 Jasper Spaans