Attention: sk_buff security struct can NOT be allocated in security_skb_alloc hooks!

From: Yuan ChunYang (cyyuanml@private)
Date: Wed Sep 24 2003 - 02:42:12 PDT

  • Next message: Stephen Smalley: "[RFC][PATCH] Pass nameidata to security_inode_permission hook"

    hi,
    
    After 2.5.66, you can not allocate security struct for sk_buff in
    security_skb_alloc hook function.
    
    In these days, my computer often is halted after installed my LSM
    module. Now maybe i find the reason.
    
    I allocate sk_buff security struct for sk_buff in security_skb_alloc
    hook funtion. But when i will free this security struct in
    security_skb_free, i find that the point of skb->lsm_security is NULL.
    
    In source codes ,i find this statement " memset(skb, 0, offsetof(struct
    sk_buff, truesize));" in alloc_skb function in 2.5.72. So alloc_skb set
    skb->lsm_security to NULL . 
    
    I allocate memory for sk_buff but can not free it in security_skb_free.
    Then my computer is halted often .
    



    This archive was generated by hypermail 2b30 : Wed Sep 24 2003 - 02:42:17 PDT