Tigran Aivazian writes:
> On Sat, 10 Jun 2000, Alexander Viro wrote:
> > > - although not documented, you need to do kern_mount() before trying
> >     Yup.
> > >   normal mounts of a FS_SINGLE; perhaps kern_mount()/kern_umount()
> > >   should be called automatically in
> > >   register_filesystem()/unregister_filesystem()?
> > 
> > I don't think so. They are different operations and I'm not too happy
> > about mixing them together. Matter of taste, but...
> 
> In get_sb_single() you wrote:
> 
>         sb = fs_type->kern_mnt->mnt_sb;
>         if (!sb)
>                 BUG();
> 
> and it is kern_mount() that initialises type->kern_mnt. So, if one forgot
> to kern_mount a FS_SINGLE filesystem prior to letting userspace try to
> mount(2) it, then it is not the BUG() that we hit but an oops of this
> kind:
> 
> Code;  c013c6b1 <get_sb_single+59/98>   <=====
>    0:   8b 58 1c                  mov    0x1c(%eax),%ebx   <=====
> 
> (0x1c being offset of mnt_sb in vfsmount)
> 
> i.e. maybe we should really have in get_sb_single():
> 
> if (!fs_type->kern_mnt || !(sb = fs_type->kern_mnt->mnt_sb))
>     BUG();
> 
> I.e. if one forgot to kern_mount then fs_type->kern_mnt will be probably
> left at NULL so one is more likely to follow a NULL pointer via ->kern_mnt
> rather that follow somewhere valid and then find NULL via ->mnt_sb?
> 
> Richard, how is it that you actually hit the BUG() above?

Hm. Digging back into my archives, I see I said I got a kernel BUG. So
that means I got a BUG, not an Oops. Perhaps that means that *fs_type
hasn't been initialised to 0, or perhaps that fs_type->kern_mnt gets
initialised elsewhere even when kern_mount() isn't called (and perhaps
kern_mount() just initialises fs_type->kern_mnt->mnt_sb).
Speculations only: I haven't RTFS.

                                Regards,

                                        Richard....
Permanent: [EMAIL PROTECTED]
Current:   [EMAIL PROTECTED]

Reply via email to