--- linux-2.4.22-rsbac-v1.2.2/rsbac/data_structures/aci_data_structures.c.sik 2003-10-28 15:51:44.000000000 +0100 +++ linux-2.4.22-rsbac-v1.2.2/rsbac/data_structures/aci_data_structures.c 2003-11-17 09:16:41.000000000 +0100 @@ -9271,8 +9271,9 @@ /* get the parent of a target * returns -RSBAC_EINVALIDTARGET for non-fs targets * and -RSBAC_ENOTFOUND, if no parent available - * In kernels >= 2.4.0, device_p->d_covers is used and the item is properly - * locked for reading, so never call with a write lock held on device_p! + * In kernels >= 2.4.0, device_p->d_covers is used and the device_p item is + * properly locked for reading, so never call with a write lock held on + * device_p! */ #if defined(CONFIG_RSBAC_REG) EXPORT_SYMBOL(rsbac_get_parent); @@ -9334,7 +9335,9 @@ *parent_target_p = T_DIR; /* Is this dentry root of a mounted device? */ - if(tid.file.dentry_p->d_sb->s_root == tid.file.dentry_p) + if( tid.file.dentry_p->d_sb + && (tid.file.dentry_p->d_sb->s_root == tid.file.dentry_p) + ) { struct rsbac_device_list_item_t * device_p; u_long dflags; @@ -9361,12 +9364,24 @@ } else { /* no root of filesystem -> simply use d_parent, dev keeps unchanged */ + if(!tid.file.dentry_p->d_parent) + { + printk(KERN_WARNING + "rsbac_get_parent(): oops - d_parent is NULL!\n"); + return -RSBAC_ENOTFOUND; + } if(tid.file.dentry_p == tid.file.dentry_p->d_parent) { printk(KERN_WARNING "rsbac_get_parent(): oops - d_parent == dentry_p!\n"); return -RSBAC_ENOTFOUND; } + if(!tid.file.dentry_p->d_parent->d_inode) + { + printk(KERN_WARNING + "rsbac_get_parent(): oops - d_parent has no d_inode!\n"); + return -RSBAC_ENOTFOUND; + } parent_tid_p->dir.device = tid.file.device; parent_tid_p->dir.inode = tid.file.dentry_p->d_parent->d_inode->i_ino; parent_tid_p->dir.dentry_p = tid.file.dentry_p->d_parent;