Now i2o_core.c memleak/incorrectness?

Oleg Drokin (green@linuxhacker.ru)
Thu, 13 Mar 2003 22:38:29 +0300


Hello!

On Thu, Mar 13, 2003 at 07:44:23PM +0000, Alan Cox wrote:
> > There is something strange going on in drivers/scsi/dpt_i2o.c in both
> > 2.4 and 2.5. adpt_i2o_reset_hba() function allocates 4 bytes
> > for "status" stuff, then tries to reset controller, then
> > if timeout on first reset stage is reached, frees "status" and returns,
> > otherwise it proceeds to monitor "status" (which is modified by hardware
> > now, btw), and if timeout is reached, just exits.
> Correctly - I2O does the same thing in this case. Its just better to
> throw a few bytes away than risk corruption

Well, it seems that i2o does not always follow this rule.
Also i2o_init_outbound_q() seems not free this "status" thing if everything
went ok, is this intentional?
Or perhaps something like this patch is needed?

Bye,
Oleg

===== drivers/message/i2o/i2o_core.c 1.12 vs edited =====
--- 1.12/drivers/message/i2o/i2o_core.c Tue Aug 6 18:42:18 2002
+++ edited/drivers/message/i2o/i2o_core.c Thu Mar 13 22:36:40 2003
@@ -2217,7 +2217,7 @@
else
printk(KERN_ERR "%s: Outbound queue initialize timeout.\n",
c->name);
- kfree(status);
+ // Better leak this for safety: kfree(status);
return -ETIMEDOUT;
}
schedule();
@@ -2231,6 +2231,7 @@
return -ETIMEDOUT;
}

+ kfree(status);
return 0;
}

-
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/