--- linux-2.4.20-rsbac-v1.2.1-orig/rsbac/data_structures/aci_data_structures.c	2002-09-19 11:47:59.000000000 +0200
+++ linux-2.4.20-rsbac-v1.2.1/rsbac/data_structures/aci_data_structures.c	2003-01-09 14:18:23.000000000 +0100
@@ -158,11 +158,6 @@
 
 #endif /* PROC */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
-static struct super_block * sockfs_sb_p = NULL;
-static struct super_block * pipefs_sb_p = NULL;
-#endif
-
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 #ifdef CONFIG_DEVFS_MOUNT
 #include <linux/devfs_fs_kernel.h>
@@ -1616,11 +1611,35 @@
     device_p = lookup_device(kdev);
     if (!device_p)
       {
-        printk(KERN_WARNING
-               "rsbac_get_super_block(): unknown device %02u:%02u\n",
-               MAJOR(kdev), MINOR(kdev));
         rsbac_read_unlock(&device_list_head.lock, &dflags);
-        return NULL;
+        sb_p = get_super(kdev);
+        if(sb_p)
+          {
+            printk(KERN_INFO
+                   "rsbac_get_super_block(): auto-mounting device %02u:%02u\n",
+                   MAJOR(kdev), MINOR(kdev));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+            rsbac_mount(sb_p);
+#else
+            rsbac_mount(sb_p, NULL);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,8)
+            /* free super_block pointer */
+            drop_super(sb_p);
+#endif
+            rsbac_read_lock(&device_list_head.lock, &dflags);
+            device_p = lookup_device(kdev);
+            if (!device_p)
+              {
+                printk(KERN_WARNING
+                       "rsbac_get_super_block(): unknown device %02u:%02u\n",
+                       MAJOR(kdev), MINOR(kdev));
+                rsbac_read_unlock(&device_list_head.lock, &dflags);
+                return NULL;
+              }
+          }
+        else
+          return NULL;
       }
     sb_p = device_p->sb_p;
     rsbac_read_unlock(&device_list_head.lock, &dflags);
@@ -6777,21 +6796,6 @@
     #endif
     #endif
 
-    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
-    if(sockfs_sb_p)
-      {
-        printk(KERN_WARNING "rsbac_do_init(): automounting sockfs device %02u:%02u\n",
-               MAJOR(sockfs_sb_p->s_dev), MINOR(sockfs_sb_p->s_dev));
-        rsbac_mount(sockfs_sb_p, NULL);
-      }
-    if(pipefs_sb_p)
-      {
-        printk(KERN_WARNING "rsbac_do_init(): automounting pipefs device %02u:%02u\n",
-               MAJOR(pipefs_sb_p->s_dev), MINOR(pipefs_sb_p->s_dev));
-        rsbac_mount(pipefs_sb_p, NULL);
-      }
-    #endif
-
 /* Force a check, if configured */
 #ifdef CONFIG_RSBAC_INIT_CHECK
 #ifdef CONFIG_RSBAC_DEBUG
@@ -7102,20 +7106,7 @@
         printk(KERN_WARNING
                "rsbac_mount(): RSBAC not initialized while mounting DEV %02u:%02u, delaying\n",
                MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
-        #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
-        if(sb_p->s_magic == SOCKFS_MAGIC)
-          {
-            printk(KERN_WARNING
-                   "rsbac_mount(): sockfs mount detected, keeping values for later use\n");
-            sockfs_sb_p = sb_p;
-          }
-        if(sb_p->s_magic == PIPEFS_MAGIC)
-          {
-            printk(KERN_WARNING
-                   "rsbac_mount(): pipefs mount detected, keeping values for later use\n");
-            pipefs_sb_p = sb_p;
-          }
-        #endif
+
         #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         #ifdef CONFIG_DEVFS_MOUNT
         if(sb_p->s_magic == DEVFS_SUPER_MAGIC)
@@ -7127,7 +7118,6 @@
           }
         #endif
         #endif
-
         return(-RSBAC_ENOTINITIALIZED);
       }
 #ifdef CONFIG_RSBAC_DEBUG
@@ -7375,14 +7365,14 @@
                 device_p->mount_count--;
                 if(device_p->d_covers == d_covers)
                   {
-                    printk(KERN_WARNING "rsbac_mount: removed primary mount for device %02u:%02u, inheritance broken!\n",
+                    printk(KERN_WARNING "rsbac_umount: removed primary mount for device %02u:%02u, inheritance broken!\n",
                            MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
                     device_p->d_covers = NULL;
                   }
               }
             else
               {
-                printk(KERN_WARNING "rsbac_mount: device %02u:%02u has mount_count < 1!\n",
+                printk(KERN_WARNING "rsbac_umount: device %02u:%02u has mount_count < 1!\n",
                        MAJOR(sb_p->s_dev), MINOR(sb_p->s_dev));
               }
           }
@@ -8792,12 +8782,37 @@
             device_p = lookup_device(tid.file.device);
             if (!device_p)
               {
-                printk(KERN_WARNING
-                       "rsbac_get_attr(): Could not lookup device %02u:%02u!\n",
-                       MAJOR(tid.file.device), MINOR(tid.file.device));
-                /* free read lock */
+                struct super_block * sb_p;
+
                 rsbac_read_unlock(&device_list_head.lock, &dflags);
-                return(-RSBAC_EINVALIDDEV);
+                sb_p = get_super(tid.file.device);
+                if(sb_p)
+                  {
+                    printk(KERN_INFO
+                           "rsbac_get_attr(): auto-mounting device %02u:%02u\n",
+                           MAJOR(tid.file.device), MINOR(tid.file.device));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+                    rsbac_mount(sb_p);
+#else
+                    rsbac_mount(sb_p, NULL);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,8)
+                    /* free super_block pointer */
+                    drop_super(sb_p);
+#endif
+                    rsbac_read_lock(&device_list_head.lock, &dflags);
+                    device_p = lookup_device(tid.file.device);
+                    if (!device_p)
+                      {
+                        printk(KERN_WARNING
+                               "rsbac_get_attr(): unknown device %02u:%02u\n",
+                               MAJOR(tid.file.device), MINOR(tid.file.device));
+                        rsbac_read_unlock(&device_list_head.lock, &dflags);
+                        return -RSBAC_EINVALIDDEV;
+                      }
+                  }
+                else
+                  return -RSBAC_EINVALIDDEV;
               }
             switch(module)
               {
@@ -10744,11 +10759,37 @@
             device_p = lookup_device(tid.file.device);
             if (!device_p)
               {
-                printk(KERN_WARNING
-                       "rsbac_set_attr(): Could not lookup device!\n");
-                /* free read lock */
+                struct super_block * sb_p;
+
                 rsbac_read_unlock(&device_list_head.lock, &dflags);
-                return(-RSBAC_EINVALIDDEV);
+                sb_p = get_super(tid.file.device);
+                if(sb_p)
+                  {
+                    printk(KERN_INFO
+                           "rsbac_set_attr(): auto-mounting device %02u:%02u\n",
+                           MAJOR(tid.file.device), MINOR(tid.file.device));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+                    rsbac_mount(sb_p);
+#else
+                    rsbac_mount(sb_p, NULL);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,8)
+                    /* free super_block pointer */
+                    drop_super(sb_p);
+#endif
+                    rsbac_read_lock(&device_list_head.lock, &dflags);
+                    device_p = lookup_device(tid.file.device);
+                    if (!device_p)
+                      {
+                        printk(KERN_WARNING
+                               "rsbac_set_attr(): unknown device %02u:%02u\n",
+                               MAJOR(tid.file.device), MINOR(tid.file.device));
+                        rsbac_read_unlock(&device_list_head.lock, &dflags);
+                        return -RSBAC_EINVALIDDEV;
+                      }
+                  }
+                else
+                  return -RSBAC_EINVALIDDEV;
               }
             switch(module)
               {
@@ -12498,8 +12539,40 @@
 
             /* lookup device */
             device_p = lookup_device(tid.file.device);
-            if (device_p)
+            if (!device_p)
               {
+                struct super_block * sb_p;
+
+                rsbac_read_unlock(&device_list_head.lock, &dflags);
+                sb_p = get_super(tid.file.device);
+                if(sb_p)
+                  {
+                    printk(KERN_INFO
+                           "rsbac_remove_target(): auto-mounting device %02u:%02u\n",
+                           MAJOR(tid.file.device), MINOR(tid.file.device));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+                    rsbac_mount(sb_p);
+#else
+                    rsbac_mount(sb_p, NULL);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,8)
+                    /* free super_block pointer */
+                    drop_super(sb_p);
+#endif
+                    rsbac_read_lock(&device_list_head.lock, &dflags);
+                    device_p = lookup_device(tid.file.device);
+                    if (!device_p)
+                      {
+                        printk(KERN_WARNING
+                               "rsbac_remove_target(): unknown device %02u:%02u\n",
+                               MAJOR(tid.file.device), MINOR(tid.file.device));
+                        rsbac_read_unlock(&device_list_head.lock, &dflags);
+                        return -RSBAC_EINVALIDDEV;
+                      }
+                  }
+                else
+                  return -RSBAC_EINVALIDDEV;
+              }
                 rsbac_list_remove(device_p->handles.gen[gen_fd_hash(tid.file.inode)],
                                   &tid.file.inode);
 #if defined(CONFIG_RSBAC_MAC)
@@ -12540,9 +12613,6 @@
                 rsbac_list_remove(device_p->handles.cap[cap_fd_hash(tid.file.inode)],
                                   &tid.file.inode);
 #endif
-              }
-            else
-              error = -RSBAC_EINVALIDDEV;
 
             /* free access to device_list_head */
             rsbac_read_unlock(&device_list_head.lock, &dflags);
--- linux-2.4.20-rsbac-v1.2.1-orig/rsbac/data_structures/gen_lists.c	2002-08-29 10:02:00.000000000 +0200
+++ linux-2.4.20-rsbac-v1.2.1/rsbac/data_structures/gen_lists.c	2003-01-06 10:26:37.000000000 +0100
@@ -3562,7 +3562,7 @@
                 if(subcount != -RSBAC_ENOTWRITABLE)
                   printk(KERN_WARNING
                          "rsbac_write_lists(): write_list() for list of lists %s returned error %i\n",
-                         item_p->name, subcount);
+                         lol_item_p->name, subcount);
               }
             else
               count++;
