public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Now i2o_core.c memleak/incorrectness?
Date: Thu, 13 Mar 2003 22:38:29 +0300	[thread overview]
Message-ID: <20030313193829.GA2940@linuxhacker.ru> (raw)
In-Reply-To: <1047584663.25948.75.camel@irongate.swansea.linux.org.uk>

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;
 }
 

  parent reply	other threads:[~2003-03-13 19:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-13 18:28 dpt_i2o.c memleak/incorrectness Oleg Drokin
2003-03-13 19:44 ` Alan Cox
2003-03-13 18:41   ` dpt_i2o.c fix for possibly memory corruption on reset timeout Oleg Drokin
2003-03-13 18:51     ` Randy.Dunlap
2003-03-13 18:56       ` Oleg Drokin
2003-03-14  9:18         ` Denis Vlasenko
2003-03-14 12:02           ` Joern Engel
2003-03-14 14:19           ` Alan Cox
2003-03-14 13:39             ` Joern Engel
2003-03-14 13:43               ` Oleg Drokin
2003-03-14 15:26                 ` Alan Cox
2003-03-13 18:58   ` dpt_i2o.c memleak/incorrectness Bryan Andersen
2003-03-15 16:15     ` Horst von Brand
2003-03-13 19:38   ` Oleg Drokin [this message]
2003-03-14  0:42     ` Now i2o_core.c memleak/incorrectness? Alan Cox

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=20030313193829.GA2940@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox