Skip to content

cifs: do not leak EDEADLK to dgetents64

Ronnie Sahlberg linux-cifs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 0 repliesNew

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] cifs: do not leak EDEADLK to dgetents64

Steve, List

Please find a patch that stops us from leaking EDEADLK (not enough credits) to userspace when we do not have enough credits due to a pending reconnect. This can be triggered for example if the server responds with STATUS_USER_SESSION_DELETED during the Create part of the Create/QueryDir that starts a directory scan.

Easiest way to reproduce this is patching up scrambla to inject this error every 3 directory scans:

server/server.py +12 -0
index 7fd113b..47d0b7f 100644
@@ -26,6 +26,7 @@ from smb2.filesystem_info import *
 from smb2.dir_info import *
 from smb2.ntlmssp import *
 
+
 class File(object):
 
     def __init__(self, path, flags, at, **kwargs):
@@ -81,6 +82,7 @@ class Server(object):
     dialect = 0
     
     def __init__(self, s, **kwargs):
+        self.errc = 0
         self._s = s
         self._sesid = 1
         self._treeid = 1
@@ -348,6 +350,16 @@ class Server(object):
         #
         # Create/Open
         #
+        #print('PDU', pdu)
+        if pdu['desired_access'] == 0x81:
+            print('YEAH')
+            self.errc = self.errc + 1
+            if self.errc == 3:
+                print('Generate error')
+                self.errc = 0
+                self._compound_error = Status.INVALID_PARAMETER
+                return (Status.USER_SESSION_DELETED,
+                        ErrorResponse.encode({'error_data' : bytes(1)}))
         if not hdr['tree_id'] in self.trees:
             self._compound_error = Status.INVALID_PARAMETER
             return (self._compound_error,