]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/cifs/smb2pdu.c
Merge branch 'karo-tx6-mainline' into stable
[karo-tx-linux.git] / fs / cifs / smb2pdu.c
index 767555518d40ccd357b6f5540f2758bb8be6e654..82c5f57382b24be0494bf3fb5d61e5b75d6920e5 100644 (file)
@@ -1109,21 +1109,25 @@ parse_lease_state(struct TCP_Server_Info *server, struct smb2_create_rsp *rsp,
 {
        char *data_offset;
        struct create_context *cc;
-       unsigned int next = 0;
+       unsigned int next;
+       unsigned int remaining;
        char *name;
 
        data_offset = (char *)rsp + 4 + le32_to_cpu(rsp->CreateContextsOffset);
+       remaining = le32_to_cpu(rsp->CreateContextsLength);
        cc = (struct create_context *)data_offset;
-       do {
-               cc = (struct create_context *)((char *)cc + next);
+       while (remaining >= sizeof(struct create_context)) {
                name = le16_to_cpu(cc->NameOffset) + (char *)cc;
-               if (le16_to_cpu(cc->NameLength) != 4 ||
-                   strncmp(name, "RqLs", 4)) {
-                       next = le32_to_cpu(cc->Next);
-                       continue;
-               }
-               return server->ops->parse_lease_buf(cc, epoch);
-       } while (next != 0);
+               if (le16_to_cpu(cc->NameLength) == 4 &&
+                   strncmp(name, "RqLs", 4) == 0)
+                       return server->ops->parse_lease_buf(cc, epoch);
+
+               next = le32_to_cpu(cc->Next);
+               if (!next)
+                       break;
+               remaining -= next;
+               cc = (struct create_context *)((char *)cc + next);
+       }
 
        return 0;
 }
@@ -2572,6 +2576,22 @@ SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
        return rc;
 }
 
+int
+SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
+                 u64 persistent_fid, u64 volatile_fid)
+{
+       __u8 delete_pending = 1;
+       void *data;
+       unsigned int size;
+
+       data = &delete_pending;
+       size = 1; /* sizeof __u8 */
+
+       return send_set_info(xid, tcon, persistent_fid, volatile_fid,
+                       current->tgid, FILE_DISPOSITION_INFORMATION, 1, &data,
+                       &size);
+}
+
 int
 SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
                  u64 persistent_fid, u64 volatile_fid, __le16 *target_file)