Re: [PATCH 0/2] smb: client: fix "df: Resource temporarily unavailable" on 5.10 stable kernel

From: Harshit Mogalapalli
Date: Sat Jan 27 2024 - 01:43:28 EST


Hi,

Adding more people to CC.(who have looked at this issue)

On 27/01/24 6:19 am, Greg KH wrote:
On Fri, Jan 26, 2024 at 10:31:41PM +0300, kovalev@xxxxxxxxxxxx wrote:
After mounting a remote cifs resource, it becomes unavailable:
df: /mnt/sambashare: Resource temporarily unavailable

It was tested on the following Linux kernels:
Linux altlinux 5.10.208-std-def-alt1
Linux fedora 5.10.208-200.el8.x86_64

The error appeared starting from kernel 5.10.206 after adding
the commit [1] "smb: client: fix OOB in SMB2_query_info_init()",
in which the buffer length increases by 1 as a result of changes:
...
- iov[0].iov_len = total_len - 1 + input_len;
+ iov[0].iov_len = len;
...


We can reproduce this on 5.15.148(latest 5.15.y) and Mohamed reported this on 6.1.y, so we need backports there as well.

https://lore.kernel.org/all/09738f0f-53a2-43f1-a09d-a2bef48e1344@xxxxxxxxxx/


[root@vm1 xfstests-dev]# ./check -g quick -s smb3
TEST_DEV=//<SERVER_IP>/TEST is mounted but not a type cifs filesystem
[root@vm1 xfstests-dev]# df
df: /mnt/test: Resource temporarily unavailable


This two patch series doesn't cleanly apply to 5.15.y.

Also I am unsure, which is the better approach to go with

Approach 1 - suggested by Paulo:
https://lore.kernel.org/all/446860c571d0699ed664175262a9e84b@xxxxxxxxxxxxx/

Approach 2 - this series
Pulling in [PATCH 2/2] smb3: Replace smb2pdu 1-element arrays with flex-arrays like this series did.

I think approach 1 is better as the changes are minimal, but please correct me if that seems wrong.

Thanks,
Harshit
[1] https://patchwork.kernel.org/project/cifs-client/patch/20231213152557.6634-2-pc@xxxxxxxxxxxxx/

Error fixed by backported commits in next two patches adapted for the 5.10 kernel:

[PATCH 1/2] stddef: Introduce DECLARE_FLEX_ARRAY() helper
[PATCH 2/2] smb3: Replace smb2pdu 1-element arrays with flex-arrays



Now queued up, thanks.

greg k-h