[linux-cifs-client] Re: [PATCH] [CIFS] Prevent OOPs when mounting with remote prefixpath

Shirish Pargaonkar shirishpargaonkar at gmail.com
Fri Feb 13 19:18:43 GMT 2009


On Fri, Feb 13, 2009 at 12:15 PM, Steve French <smfrench at gmail.com> wrote:
> The DFS mount now works?
>
> On Fri, Feb 13, 2009 at 11:32 AM, Shirish Pargaonkar
> <shirishpargaonkar at gmail.com> wrote:
>>
>> On Fri, Feb 13, 2009 at 8:36 AM, Jeff Layton <jlayton at redhat.com> wrote:
>> > On Thu, 12 Feb 2009 23:18:16 -0600
>> > Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:
>> >
>> >> On Tue, Feb 3, 2009 at 4:22 AM, Igor Mammedov <niallain at gmail.com>
>> >> wrote:
>> >> > Managed to single out the part of  DFS root support from a big patch
>> >> > with a little modification.
>> >> > It will report error and fail to mount if perfixpath is on remote
>> >> > server.
>> >> > As well it will not scare people off with a error
>> >> > 'kernel BUG at fs/cifs/cifs_dfs_ref.c:274!'.
>> >> >
>> >> >
>> >> > ---------
>> >> > Fixes OOPs with message 'kernel BUG at fs/cifs/cifs_dfs_ref.c:274!'.
>> >> > Check if prefixpath in accessible while we are still in cifs_mount
>> >> > and fail with reporting a error if we can't access prefixpath
>> >> > (i.e. if prefixpath is located on another server)
>> >> >
>> >> >
>> >> > Best regards,
>> >> >
>> >> > -------------------------
>> >> > Igor Mammedov,
>> >> > niallain "at" gmail.com
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >> We need to bring back NIPQUAD and NIPQUAD_FMT back in cifs_mount
>> >> instead of %pI4 i..e.
>> >> sprintf(pSesInfo->serverName, NIPQUAD_FMT,
>> >>
>> >> NIPQUAD(srvTcp->addr.sockAddr.sin_addr.s_addr));
>> >> If we sprintf hex address in serverName instead of dotted-decimal
>> >> notation, the Path parameter in Tree Connect
>> >> to IPC$ share on the server to get dfs referral fails,
>> >> \\hex_address\IPC$ is not a valid UNC path name.
>> >>
>> >> I have not tried on a IPv6 setup, but I suspect the same applies to
>> >> IPv6 formatting.
>> >>
>> >
>> > I'm afraid I don't follow this. %pI4 formats the address in
>> > dotted-decimal format, not as a hex address. %pI6 should format it the
>> > same way that NIP6_FMT did.
>> >
>> > --
>> > Jeff Layton <jlayton at redhat.com>
>> >
>>
>> Jeff,
>>
>> You are right, it works. I was using 2.6.29-rc3 cifs code in 2.6.27
>> and  I think that is why.
>>
>> Regards,
>>
>> Shirish
>
>
>
> --
> Thanks,
>
> Steve
>

DFS mount works on 2.6.29-rc3 with the current code (%pI6 and %pI4)
but the machine still
crashes when I try to list the mount (i.e. ls -l <mounted_filesystem),
no resolution there yet.

DFS mount works, because I am back to using this on 2.6.27.8-1-default

                if (srvTcp->addr.sockAddr6.sin6_family == AF_INET6)
                        sprintf(pSesInfo->serverName, "%pI6",
                                &srvTcp->addr.sockAddr6.sin6_addr);
                else {
                        sprintf(pSesInfo->serverName, NIPQUAD_FMT,
                                NIPQUAD(srvTcp->addr.sockAddr.sin_addr));
                }

But wiith this patch prefixpath does not seem to work for me, either
when prefix path is local on the dfslink or prefix path
is a mounted share on the dfslink (no crashes or oopses though)

This works

mount -t cifs //cifstest1/dfsroot /mnt/smb_a -o user=user,pass=password

ls -l /mnt/smb_a
total 0
drwxrwxrwx 1 root root 0 Feb 11 18:40 linktocifstest4

ls -l /mnt/smb_a/linktocifstest4
total 4
drwxr-xr-x  2 root root  0 Feb  6 03:35 dir1
drwxr-xr-x 14 root root  0 Jan 18  2006 dir2
-rw-r--r--  1 root root 18 Nov 10 09:32 file1


This fails (dir1 exists locally on cifstest4 share (the dfslink'ed machine),

mount -t cifs //cifstest1/dfsroot /mnt/smb_a -o
prefixpath=dir1,user=user,pass=password
mount error 2 = No such file or directory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

fs/cifs.ssp/transport.c: For smb_command 117
 fs/cifs.ssp/transport.c: Sending smb:  total_len 124
 fs/cifs.ssp/connect.c: rfc1002 length 0x42
 fs/cifs.ssp/connect.c: disk share connection
 fs/cifs.ssp/connect.c: Tcon flags: 0x3
 fs/cifs.ssp/connect.c: CIFS Tcon rc = 0
 fs/cifs.ssp/cifssmb.c: In QFSDeviceInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x44
 fs/cifs.ssp/cifssmb.c: In QFSAttributeInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x50
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 156
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: invalid transact2 word count
Status code returned 0xc0000034 NT_STATUS_OBJECT_NAME_NOT_FOUND
 fs/cifs.ssp/netmisc.c: Mapping smb error code 2 to POSIX err -2
 fs/cifs.ssp/cifssmb.c: Send error in QPathInfo = -2
 CIFS VFS: Path \\cifstest1\dfsroot\dir1 in not accessible: -2
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 68 with uid: 0
 fs/cifs.ssp/cifssmb.c: In tree disconnect
 fs/cifs.ssp/transport.c: For smb_command 113
 fs/cifs.ssp/transport.c: Sending smb:  total_len 39
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 69 with uid: 0
 fs/cifs.ssp/cifssmb.c: In SMBLogoff for session disconnect
 fs/cifs.ssp/transport.c: For smb_command 116
 fs/cifs.ssp/transport.c: Sending smb:  total_len 43
 fs/cifs.ssp/connect.c: rfc1002 length 0x2b
 fs/cifs.ssp/connect.c: CIFS VFS: leaving cifs_mount (xid = 67) rc = -2
 CIFS VFS: cifs_mount failed w/return code = -2


This fails as well (dir2 is mounted share from cifstest5)

mount -t cifs //cifstest1/dfsroot /mnt/smb_a -o
prefixpath=dir2,user=user,pass=password
mount error 2 = No such file or directory
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)



Then I tried this and the mount failed,

mount -t cifs //cifstest1/dfsroot /mnt/smb_a -o
prefixpath=linktocifstest4/dir1,user=user,pass=password
mount error 66 = Object is remote

 fs/cifs.ssp/cifsfs.c: Devname: //cifstest1/dfsroot flags: 64
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_mount as Xid: 79 with uid: 0
 fs/cifs.ssp/connect.c: prefix path /linktocifstest4/dir1
 fs/cifs.ssp/connect.c: Username: user
 fs/cifs.ssp/connect.c: UNC: \\cifstest1\dfsroot ip: 9.3.uvw.xyz
 fs/cifs.ssp/connect.c: Socket created
 fs/cifs.ssp/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x6d6
 fs/cifs.ssp/connect.c: Existing smb sess not found
 CIFS VFS: cifs_mount serverName: 9.3.uvw.xyz
 fs/cifs.ssp/connect.c: Demultiplex PID: 3996
 fs/cifs.ssp/cifssmb.c: secFlags 0x7
 fs/cifs.ssp/transport.c: For smb_command 114
 fs/cifs.ssp/transport.c: Sending smb:  total_len 82
 fs/cifs.ssp/connect.c: rfc1002 length 0x7d
 fs/cifs.ssp/cifssmb.c: Dialect: 2
 fs/cifs.ssp/cifssmb.c: negprot rc 0
 fs/cifs.ssp/connect.c: Security Mode: 0xf Capabilities: 0x1f3fd
TimeAdjust: 21600
 fs/cifs.ssp/sess.c: sess setup type 2
 fs/cifs.ssp/transport.c: For smb_command 115
 fs/cifs.ssp/transport.c: Sending smb:  total_len 262
 fs/cifs.ssp/connect.c: rfc1002 length 0xd1
 fs/cifs.ssp/misc.c: Null buffer passed to cifs_small_buf_release
 fs/cifs.ssp/sess.c: ssetup rc from sendrecv2 is 0
 fs/cifs.ssp/sess.c: UID = 16385
 fs/cifs.ssp/sess.c: bleft 164
 fs/cifs.ssp/sess.c: words left: -1
 fs/cifs.ssp/sess.c: ssetup freeing small buf ffff88013d499d40
 fs/cifs.ssp/connect.c: CIFS Session Established successfully
 fs/cifs.ssp/connect.c: file mode: 0x5f7  dir mode: 0x1ff
 fs/cifs.ssp/transport.c: For smb_command 117
 fs/cifs.ssp/transport.c: Sending smb:  total_len 124
 fs/cifs.ssp/connect.c: rfc1002 length 0x42
 fs/cifs.ssp/connect.c: disk share connection
 fs/cifs.ssp/connect.c: Tcon flags: 0x3
 fs/cifs.ssp/connect.c: CIFS Tcon rc = 0
 fs/cifs.ssp/cifssmb.c: In QFSDeviceInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x44
 fs/cifs.ssp/cifssmb.c: In QFSAttributeInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x50
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 188
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: invalid transact2 word count
Status code returned 0xc0000257 NT_STATUS_PATH_NOT_COVERED
 fs/cifs.ssp/netmisc.c: Mapping smb error code 3 to POSIX err -66
 fs/cifs.ssp/cifssmb.c: Send error in QPathInfo = -66
 CIFS VFS: Path \\cifstest1\dfsroot\linktocifstest4\dir1 in not accessible: -66
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 80 with uid: 0
 fs/cifs.ssp/cifssmb.c: In tree disconnect
 fs/cifs.ssp/transport.c: For smb_command 113
 fs/cifs.ssp/transport.c: Sending smb:  total_len 39
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 81 with uid: 0
 fs/cifs.ssp/cifssmb.c: In SMBLogoff for session disconnect
 fs/cifs.ssp/transport.c: For smb_command 116
 fs/cifs.ssp/transport.c: Sending smb:  total_len 43
 fs/cifs.ssp/connect.c: rfc1002 length 0x2b
 fs/cifs.ssp/connect.c: CIFS VFS: leaving cifs_mount (xid = 79) rc = -66
 CIFS VFS: cifs_mount failed w/return code = -66

mount -t cifs //cifstest1/dfsroot /mnt/smb_a -o
prefixpath=/linktocifstest4/dir2,user=user,pass=password
mount error 66 = Object is remote
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

 fs/cifs.ssp/cifsfs.c: Devname: //cifstest1/dfsroot flags: 64
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_mount as Xid: 82 with uid: 0
 fs/cifs.ssp/connect.c: prefix path /linktocifstest4/dir2
 fs/cifs.ssp/connect.c: Username: user
 fs/cifs.ssp/connect.c: UNC: \\cifstest1\dfsroot ip: 9.3.uvw.xyz
 fs/cifs.ssp/connect.c: Socket created
 fs/cifs.ssp/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x6d6
 fs/cifs.ssp/connect.c: Existing smb sess not found
 fs/cifs.ssp/connect.c: Demultiplex PID: 4047
 CIFS VFS: cifs_mount serverName: 9.3.uvw.xyz
 fs/cifs.ssp/cifssmb.c: secFlags 0x7
 fs/cifs.ssp/transport.c: For smb_command 114
 fs/cifs.ssp/transport.c: Sending smb:  total_len 82
 fs/cifs.ssp/connect.c: rfc1002 length 0x7d
 fs/cifs.ssp/cifssmb.c: Dialect: 2
 fs/cifs.ssp/cifssmb.c: negprot rc 0
 fs/cifs.ssp/connect.c: Security Mode: 0xf Capabilities: 0x1f3fd
TimeAdjust: 21600
 fs/cifs.ssp/sess.c: sess setup type 2
 fs/cifs.ssp/transport.c: For smb_command 115
 fs/cifs.ssp/transport.c: Sending smb:  total_len 262
 fs/cifs.ssp/connect.c: rfc1002 length 0xd1
 fs/cifs.ssp/misc.c: Null buffer passed to cifs_small_buf_release
 fs/cifs.ssp/sess.c: ssetup rc from sendrecv2 is 0
 fs/cifs.ssp/sess.c: UID = 40960
 fs/cifs.ssp/sess.c: bleft 164
 fs/cifs.ssp/sess.c: words left: -1
 fs/cifs.ssp/sess.c: ssetup freeing small buf ffff8801301fd300
 fs/cifs.ssp/connect.c: CIFS Session Established successfully
 fs/cifs.ssp/connect.c: file mode: 0x5f7  dir mode: 0x1ff
 fs/cifs.ssp/transport.c: For smb_command 117
 fs/cifs.ssp/transport.c: Sending smb:  total_len 124
 fs/cifs.ssp/connect.c: rfc1002 length 0x42
 fs/cifs.ssp/connect.c: disk share connection
 fs/cifs.ssp/connect.c: Tcon flags: 0x3
 fs/cifs.ssp/connect.c: CIFS Tcon rc = 0
 fs/cifs.ssp/cifssmb.c: In QFSDeviceInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x44
 fs/cifs.ssp/cifssmb.c: In QFSAttributeInfo
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 72
 fs/cifs.ssp/connect.c: rfc1002 length 0x50
 fs/cifs.ssp/transport.c: For smb_command 50
 fs/cifs.ssp/transport.c: Sending smb:  total_len 188
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: invalid transact2 word count
Status code returned 0xc0000257 NT_STATUS_PATH_NOT_COVERED
 fs/cifs.ssp/netmisc.c: Mapping smb error code 3 to POSIX err -66
 fs/cifs.ssp/cifssmb.c: Send error in QPathInfo = -66
 CIFS VFS: Path \\cifstest1\dfsroot\linktocifstest4\dir2 in not accessible: -66
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 83 with uid: 0
 fs/cifs.ssp/cifssmb.c: In tree disconnect
 fs/cifs.ssp/transport.c: For smb_command 113
 fs/cifs.ssp/transport.c: Sending smb:  total_len 39
 fs/cifs.ssp/connect.c: rfc1002 length 0x27
 fs/cifs.ssp/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 84 with uid: 0
 fs/cifs.ssp/cifssmb.c: In SMBLogoff for session disconnect
 fs/cifs.ssp/transport.c: For smb_command 116
 fs/cifs.ssp/transport.c: Sending smb:  total_len 43
 fs/cifs.ssp/connect.c: rfc1002 length 0x2b
 fs/cifs.ssp/connect.c: CIFS VFS: leaving cifs_mount (xid = 82) rc = -66
 CIFS VFS: cifs_mount failed w/return code = -66


More information about the linux-cifs-client mailing list