Skip to content

Commit 214a5ea

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: do not fail __smb_send_rqst if non-fatal signals are pending
RHBZ 1848178 The original intent of returning an error in this function in the patch: "CIFS: Mask off signals when sending SMB packets" was to avoid interrupting packet send in the middle of sending the data (and thus breaking an SMB connection), but we also don't want to fail the request for non-fatal signals even before we have had a chance to try to send it (the reported problem could be reproduced e.g. by exiting a child process when the parent process was in the midst of calling futimens to update a file's timestamps). In addition, since the signal may remain pending when we enter the sending loop, we may end up not sending the whole packet before TCP buffers become full. In this case the code returns -EINTR but what we need here is to return -ERESTARTSYS instead to allow system calls to be restarted. Fixes: b30c74c ("CIFS: Mask off signals when sending SMB packets") Cc: [email protected] # v5.1+ Signed-off-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 16a7885 commit 214a5ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cifs/transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
338338
if (ssocket == NULL)
339339
return -EAGAIN;
340340

341-
if (signal_pending(current)) {
341+
if (fatal_signal_pending(current)) {
342342
cifs_dbg(FYI, "signal pending before send request\n");
343343
return -ERESTARTSYS;
344344
}
@@ -429,7 +429,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
429429

430430
if (signal_pending(current) && (total_len != send_length)) {
431431
cifs_dbg(FYI, "signal is pending after attempt to send\n");
432-
rc = -EINTR;
432+
rc = -ERESTARTSYS;
433433
}
434434

435435
/* uncork it */

0 commit comments

Comments
 (0)