kernel memory leak fix for af_unix datagram getpeersec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: [email protected]
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);
 }
 
 
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux