linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ronnie Sahlberg <lsahlber@redhat.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Cc: Steve French <smfrench@gmail.com>
Subject: [PATCH 0/1] cifs: do not leak EDEADLK to dgetents64
Date: Wed, 25 Aug 2021 17:30:42 +1000	[thread overview]
Message-ID: <20210825073043.1630555-1-lsahlber@redhat.com> (raw)

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:
diff --git a/server/server.py b/server/server.py
index 7fd113b..47d0b7f 100644
--- a/server/server.py
+++ b/server/server.py
@@ -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,





             reply	other threads:[~2021-08-25  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-25  7:30 Ronnie Sahlberg [this message]
2021-08-25  7:30 ` [PATCH] cifs: Do not leak EDEADLK to dgetents64 for STATUS_USER_SESSION_DELETED Ronnie Sahlberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210825073043.1630555-1-lsahlber@redhat.com \
    --to=lsahlber@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    --subject='Re: [PATCH 0/1] cifs: do not leak EDEADLK to dgetents64' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).