Bug 216881

Summary: CIFS 1.0 mounts fail with "VFS: bogus file nlink value 0"
Product: File System Reporter: Kim Scarborough (kim)
Component: CIFSAssignee: fs_cifs (fs_cifs)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: mrmazda, pc, regressions
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.1.2 Subsystem:
Regression: No Bisected commit-id:
Attachments: Log file
PCAP file
patch 1
patch 2

Description Kim Scarborough 2023-01-04 07:00:50 UTC
An SMB mount to a Windows XP machine in my fstab no longer works. It last worked with 6.0.9. fstab line:

//server/D /remote/server/D cifs noauto,_netdev,username=example,password=example,uid=1000,vers=1.0,nomultichannel 0 0

When I attempt to mount this now, I get the following error:

mount error(20): Not a directory

dmesg shows:

CIFS: VFS: bogus file nlink value 0
Comment 1 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-01-05 08:15:57 UTC
(In reply to Kim Scarborough from comment #0)
> It last worked with 6.0.9.

Do you mean it broke with later 6.0.y kernels? Or did you switch to 6.1 after that?
Comment 2 Kim Scarborough 2023-01-06 02:42:21 UTC
I went to 6.1 after 6.0.9. Sorry, I should have made that clear.
Comment 3 Paulo Alcantara 2023-01-06 16:00:43 UTC
Hi Kim,

Thanks for the report.

Could you please try this patch[1] and see if it works for you?

Please make sure that you also have

	9ee2afe5207b ("cifs: prevent copying past input buffer boundaries")

[1] https://pc.cjr.nz/smb1.diff
Comment 4 Kim Scarborough 2023-01-06 21:22:30 UTC
I applied the patch and installed the new kernel, but I'm getting the same error.
Comment 5 Paulo Alcantara 2023-01-06 21:33:52 UTC
Thanks for testing it.

In this case, please generate verbose logs and network trace

	# umount any existing shares
	dmesg --clear
	echo 'module cifs +p' > /sys/kernel/debug/dynamic_debug/control
	echo 'file fs/cifs/* +p' > /sys/kernel/debug/dynamic_debug/control
	echo 1 > /proc/fs/cifs/cifsFYI
	echo 1 > /sys/module/dns_resolver/parameters/debug
	tcpdump -s 0 -w trace.pcap port 445 & pid=$!
	sleep 3
	mount.cifs ...
	sleep 3
	kill $pid
	dmesg > trace.log
	cat /proc/fs/cifs/dfscache >> trace.log

and then send trace.log and trace.pcap files.
Comment 6 Kim Scarborough 2023-01-06 22:05:22 UTC
Created attachment 303540 [details]
Log file
Comment 7 Kim Scarborough 2023-01-06 22:06:39 UTC
Created attachment 303541 [details]
PCAP file
Comment 8 Paulo Alcantara 2023-01-06 23:39:08 UTC
Created attachment 303542 [details]
patch 1
Comment 9 Paulo Alcantara 2023-01-06 23:39:41 UTC
Created attachment 303543 [details]
patch 2
Comment 10 Paulo Alcantara 2023-01-06 23:40:21 UTC
Hi Jim,

Thanks for providing the logs and trace.

Could you please try the two attached patches instead?
Comment 11 Paulo Alcantara 2023-01-06 23:40:49 UTC
s/Jim/Kim/
Comment 12 Kim Scarborough 2023-01-07 02:55:01 UTC
Those fixed it. Thanks!
Comment 13 Paulo Alcantara 2023-01-09 17:36:12 UTC
FYI, fixes[1] sent upstream already.

[1] https://lore.kernel.org/linux-cifs/20230107200134.4822-1-pc@cjr.nz/T/#t
Comment 14 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-01-09 18:12:38 UTC
(In reply to Paulo Alcantara from comment #13)
> FYI, fixes[1] sent upstream already.
> [1] https://lore.kernel.org/linux-cifs/20230107200134.4822-1-pc@cjr.nz/T/#t

FWIW, that "Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216881" should have been "Link: https://bugzilla.kernel.org/show_bug.cgi?id=216881" (see Documentation/process/submitting-patches.rst , Documentation/process/5.Posting.rst or mails like these:

https://lore.kernel.org/all/CAHk-=wjMmSZzMJ3Xnskdg4+GGz=5p5p+GSYyFBTh0f-DgvdBWg@mail.gmail.com/
https://lore.kernel.org/all/CAHk-=wgs38ZrfPvy=nOwVkVzjpM3VFU1zobP37Fwd_h9iAD5JQ@mail.gmail.com/
https://lore.kernel.org/all/CAHk-=wjxzafG-=J8oT30s7upn4RhBs6TX-uVFZ5rME+L5_DoJA@mail.gmail.com/ )
Comment 15 Paulo Alcantara 2023-01-09 18:22:09 UTC
(In reply to The Linux kernel's regression tracker (Thorsten Leemhuis) from comment #14)
> (In reply to Paulo Alcantara from comment #13)
> > FYI, fixes[1] sent upstream already.
> > [1] https://lore.kernel.org/linux-cifs/20230107200134.4822-1-pc@cjr.nz/T/#t
> 
> FWIW, that "Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216881" should
> have been "Link: https://bugzilla.kernel.org/show_bug.cgi?id=216881" (see
> Documentation/process/submitting-patches.rst ,
> Documentation/process/5.Posting.rst or mails like these:
> 
> https://lore.kernel.org/all/CAHk-=wjMmSZzMJ3Xnskdg4+GGz=5p5p+GSYyFBTh0f-
> DgvdBWg@mail.gmail.com/
> https://lore.kernel.org/all/CAHk-
> =wgs38ZrfPvy=nOwVkVzjpM3VFU1zobP37Fwd_h9iAD5JQ@mail.gmail.com/
> https://lore.kernel.org/all/CAHk-=wjxzafG-=J8oT30s7upn4RhBs6TX-
> uVFZ5rME+L5_DoJA@mail.gmail.com/ )

Thanks!  I'll ask Steve to fix those before merging.