lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 15 Mar 2007 01:48:27 +0100
From:	Samir Bellabes <sam@...ack.fr>
To:	Evgeniy Polyakov <johnpol@....mipt.ru>
Cc:	netdev@...r.kernel.org
Subject: Re: [RFC] [PATCH] Network Events Connector

Evgeniy Polyakov <johnpol@....mipt.ru> writes:

> On Fri, Feb 09, 2007 at 05:43:14AM +0100, Samir Bellabes (sam@...ack.fr) wrote:
>> Hi,
>> 
>> Here is a new feature which can help firewalls to be more application
>> aware, so more useful for people.
>> 
>> Our previous discussion about cn_net and firewalls:
>> http://marc2.theaimsgroup.com/?t=115976957500002&r=1&w=2
>> 
>> Please, I would really like to have feedback and comments on that tool,
>> in order to improve it.
>
> Technical side does have problems.
> 2. initialization path has problems - hash is allocated after securty
> hooks and connector moduler are registered.

I see. Here is a patch, to apply on top of previous.

commit 7c89bcb9cc07b02023c9a43b80ff1df7cb07b900
Author: Samir Bellabes <sam@...ack.fr>
Date:   Mon Feb 19 15:16:05 2007 +0100

    [PATCH] cn_net: fix initialization path
    
    'hash' is allocated after the registration of security hooks and
    connector callback.
    
    Noticed by Evgeniy Polyakov <johnpol@....mipt.ru>
    
    Signed-off-by: Samir Bellabes <sam@...ack.fr>

diff --git a/drivers/connector/cn_net.c b/drivers/connector/cn_net.c
index 1f681f6..c9eb53e 100644
--- a/drivers/connector/cn_net.c
+++ b/drivers/connector/cn_net.c
@@ -537,13 +537,22 @@ static struct security_operations cn_net
 };
 
 static int __init init(void) {
-	int err, i;
+	int err = 0, i = 0;
 
-	err = cn_add_callback(&cn_net_event_id, cn_net_event_name, &cn_net_ctl);
+	hash = kzalloc(sizeof(struct list_head) * hash_size, GFP_KERNEL);
+	if (!hash) {
+		printk(KERN_WARNING "cn_net: Failure can't alloc memory for hash\n");
+		err = -ENOMEM;
+		goto out;
+	}
+	
+	for (i = 0; i < hash_size; i++)
+		INIT_LIST_HEAD(&(hash[i]));
 
+	err = cn_add_callback(&cn_net_event_id, cn_net_event_name, &cn_net_ctl);
 	if (err) {
 		printk(KERN_WARNING "cn_net: Failure add connector callback\n");
-		goto out;
+		goto out_callback;
 	}
 
 	if (register_security(&cn_net_security_ops)) {
@@ -558,33 +567,15 @@ static int __init init(void) {
 		secondary = 1;
 	}
 
-
-	hash = kzalloc(sizeof(struct list_head) * hash_size, GFP_KERNEL);
-	if (!hash)
-		goto out_nomem_hash;
-	
-	for (i = 0; i < hash_size; i++)
-		INIT_LIST_HEAD(&(hash[i]));
-
-	printk(KERN_INFO "cn_net: module loaded\n");
-
+	printk(KERN_INFO "cn_net: network events module loaded\n");
 	return 0;
 
-out_nomem_hash:
-	err = -ENOMEM;
-
-	if (secondary) {
-		if (mod_unreg_security(MY_NAME, &cn_net_security_ops))
-			printk(KERN_INFO "cn_net: Failure unregistering with"
-			       " primary security module\n");
-	} else {
-		if (unregister_security(&cn_net_security_ops))
-			printk(KERN_INFO "cn_net: Failure unregistering with "
-			       "kernel\n");
-	}
-
 out_security:
 	cn_del_callback(&cn_net_event_id);
+
+out_callback:
+	kfree(hash);
+
 out:
 	return err;
 }

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ