From: Catherine Zhang <cxzhang@watson.ibm.com>
To: linux-kernel@vger.kernel.org, michal.k.k.piotrowski@gmail.com,
catalin.marinas@gmail.com
Cc: czhang.us@gmail.com, James Morris <jmorris@namei.org>,
Stephen Smalley <sds@tycho.nsa.gov>
Subject: kernel memory leak fix for af_unix datagram getpeersec
Date: Sun, 16 Jul 2006 00:57:31 -0400 [thread overview]
Message-ID: <20060716045731.GA303@jiayuguan.watson.ibm.com> (raw)
Hi, Catalin and Michal,
Enclosed please find the patch against 2.6.18-rc1 that fixed the kernel
memory leak problem.
Thanks for your help!
Catherine
--
From: cxzhang@watson.ibm.com
Fix the memory leak problem of the original unix datagram getpeersec patch.
---
include/net/scm.h | 4 +++-
net/ipv4/ip_sockglue.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff -puN include/net/scm.h~af_unix-datagram-getpeersec-ml-fix include/net/scm.h
--- linux-2.6.18-rc1/include/net/scm.h~af_unix-datagram-getpeersec-ml-fix 2006-07-14 20:44:13.000000000 -0400
+++ linux-2.6.18-rc1-cxzhang/include/net/scm.h 2006-07-14 20:45:07.000000000 -0400
@@ -55,8 +55,10 @@ static __inline__ int scm_send(struct so
#ifdef CONFIG_SECURITY_NETWORK
static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
{
- if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
+ if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL) {
put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, scm->seclen, scm->secdata);
+ kfree(scm->secdata);
+ }
}
#else
static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
diff -puN net/ipv4/ip_sockglue.c~af_unix-datagram-getpeersec-ml-fix net/ipv4/ip_sockglue.c
--- linux-2.6.18-rc1/net/ipv4/ip_sockglue.c~af_unix-datagram-getpeersec-ml-fix 2006-07-15 19:03:07.000000000 -0400
+++ linux-2.6.18-rc1-cxzhang/net/ipv4/ip_sockglue.c 2006-07-15 19:03:27.000000000 -0400
@@ -120,6 +120,7 @@ static void ip_cmsg_recv_security(struct
return;
put_cmsg(msg, SOL_IP, SCM_SECURITY, seclen, secdata);
+ kfree(secdata);
}
_
next reply other threads:[~2006-07-16 4:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-16 4:57 Catherine Zhang [this message]
2006-07-16 4:57 ` James Morris
2006-07-16 11:16 ` Michal Piotrowski
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=20060716045731.GA303@jiayuguan.watson.ibm.com \
--to=cxzhang@watson.ibm.com \
--cc=catalin.marinas@gmail.com \
--cc=czhang.us@gmail.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=sds@tycho.nsa.gov \
/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®