Stefan Metzmacher <metze@xxxxxxxxx> wrote: > Please keep the rfc1002_len variable as it's used in the log_read message > below and it should by host byteorder. So this change on top of the patch I posted? @@ -1838,11 +1838,11 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg) * transport layer is added */ if (response->first_segment && size == 4) { - unsigned int len = + unsigned int rfc1002_len = data_length + remaining_data_length; - __be32 rfc1002_len = cpu_to_be32(len); - if (copy_to_iter(&rfc1002_len, sizeof(rfc1002_len), - &msg->msg_iter) != sizeof(rfc1002_len)) + __be32 rfc1002_hdr = cpu_to_be32(rfc1002_len); + if (copy_to_iter(&rfc1002_hdr, sizeof(rfc1002_hdr), + &msg->msg_iter) != sizeof(rfc1002_hdr)) return -EFAULT; data_read = 4; response->first_segment = false; Btw, I'm changing the patch subject and description to: cifs: Fix reading into an ITER_FOLIOQ from the smbdirect code When performing a file read from RDMA, smbd_recv() prints an "Invalid msg type 4" error and fails the I/O. This is due to the switch-statement there not handling the ITER_FOLIOQ handed down from netfslib. Fix this by collapsing smbd_recv_buf() and smbd_recv_page() into smbd_recv() and just using copy_to_iter() instead of memcpy(). This future-proofs the function too, in case more ITER_* types are added. Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading") Reported-by: Stefan Metzmacher <metze@xxxxxxxxx> Signed-off-by: David Howells <dhowells@xxxxxxxxxx> cc: Steve French <stfrench@xxxxxxxxxxxxx> cc: Tom Talpey <tom@xxxxxxxxxx> cc: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx> cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> cc: linux-cifs@xxxxxxxxxxxxxxx cc: netfs@xxxxxxxxxxxxxxx cc: linux-fsdevel@xxxxxxxxxxxxxxx David