On Tue, 31 May 2005 10:45:28 +0200
Jorge Lanza <[EMAIL PROTECTED]> wrote:

> Hi all.
> 
> During the last few days I've been going through the code in order to 
> understand how can I hack it to make the things I want to a packet on layer 2.
> First of all, congratulations. I have learnt a lot.
> 
> However I have a doubt. In n<http://lxr.linux.no/ident?i=new_nbp>ew_nbp() 
> funtion in br_if.c you make a kalloc for the port. While reading the code I 
> haven't seen any kfree for that memory, which should be done in 
> <http://lxr.linux.no/ident?i=del_nbp>del_nbp or similar functions. In 
> <http://lxr.linux.no/ident?i=destroy_nbp>destroy_nbp you set the pointer to 
> null, but I think that's not enough. I don't know if it is a bug or is sth 
> that is done somewhere else.

What kernel version?
        For 2.6
                kmalloc of port data is in br_if:new_nbp
                kfree is done by:
                del_nbp calls destroy_nbp (via rcu)
                   calls br_sysfs_freeif which does kobject_put(of port kobj)
                        when ref == 0 calls brport_release (through 
brport_ktype)

This complexity comes because application could have 
/sys/class/net/ethX/brif/port_id
or other file open, in which case the bridge port can't be deleted. Until last
reference is zero.
                
_______________________________________________
Bridge mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/bridge

Reply via email to