From: Robert Love <rml@tech9.net>
To: Dawson Engler <engler@csl.Stanford.EDU>
Cc: linux-kernel@vger.kernel.org, mc@cs.Stanford.EDU,
marcelo@conectiva.com.br
Subject: Re: [CHECKER] 24 memory leaks on error paths in 2.4.17
Date: 10 Jun 2002 15:45:32 -0700 [thread overview]
Message-ID: <1023749132.21176.122.camel@sinai> (raw)
In-Reply-To: <200206100355.UAA17053@csl.Stanford.EDU>
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
On Sun, 2002-06-09 at 20:55, Dawson Engler wrote:
> This checker warns when you do not free allocated memory on failure paths.
> Note: while we only include 24 errors, there were lots in general; let me
> know if more are useful.
Yes they are very useful! The work you do is amazingly useful and you
have quite a neat tool there ;)
> 1 | /2.4.17/socket.c
>
> if ((sk=sock->sk) == NULL)
> Error --->
> return -EINVAL;
Yep, this is a bug. It is tricky because in cases where !on, fna does
not need to be freed... so I can see how this was missed.
Marcelo, attached patch, against 2.4.19-pre10, fixes this bug...
Robert Love
[-- Attachment #2: socket-leak-rml-2.4.19-pre10-1.patch --]
[-- Type: text/x-patch, Size: 422 bytes --]
diff -urN linux-2.4.19-pre10/net/socket.c linux/net/socket.c
--- linux-2.4.19-pre10/net/socket.c Mon Jun 10 15:26:30 2002
+++ linux/net/socket.c Mon Jun 10 15:37:48 2002
@@ -743,11 +743,13 @@
return -ENOMEM;
}
-
sock = socki_lookup(filp->f_dentry->d_inode);
- if ((sk=sock->sk) == NULL)
+ if ((sk=sock->sk) == NULL) {
+ if (fna)
+ kfree(fna);
return -EINVAL;
+ }
lock_sock(sk);
prev parent reply other threads:[~2002-06-10 22:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-10 3:55 Dawson Engler
2002-06-10 22:45 ` Robert Love [this message]
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=1023749132.21176.122.camel@sinai \
--to=rml@tech9.net \
--cc=engler@csl.Stanford.EDU \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=mc@cs.Stanford.EDU \
/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
all inboxes | Powered by JetHome®