cifs: reinstate sec=ntlmv2 mount option
[firefly-linux-kernel-4.4.55.git] / fs / cifs / connect.c
index 0ae86ddf22138180383542548b3fb7e003c94453..a675b7f47d6347738de2d74633a7039670879d6d 100644 (file)
@@ -238,8 +238,8 @@ static const match_table_t cifs_mount_option_tokens = {
 enum {
        Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p,
        Opt_sec_ntlmsspi, Opt_sec_ntlmssp,
-       Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2i,
-       Opt_sec_nontlm, Opt_sec_lanman,
+       Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2,
+       Opt_sec_ntlmv2i, Opt_sec_lanman,
        Opt_sec_none,
 
        Opt_sec_err
@@ -253,8 +253,9 @@ static const match_table_t cifs_secflavor_tokens = {
        { Opt_sec_ntlmssp, "ntlmssp" },
        { Opt_ntlm, "ntlm" },
        { Opt_sec_ntlmi, "ntlmi" },
+       { Opt_sec_ntlmv2, "nontlm" },
+       { Opt_sec_ntlmv2, "ntlmv2" },
        { Opt_sec_ntlmv2i, "ntlmv2i" },
-       { Opt_sec_nontlm, "nontlm" },
        { Opt_sec_lanman, "lanman" },
        { Opt_sec_none, "none" },
 
@@ -1167,7 +1168,7 @@ static int cifs_parse_security_flavors(char *value,
        case Opt_sec_ntlmi:
                vol->secFlg |= CIFSSEC_MAY_NTLM | CIFSSEC_MUST_SIGN;
                break;
-       case Opt_sec_nontlm:
+       case Opt_sec_ntlmv2:
                vol->secFlg |= CIFSSEC_MAY_NTLMV2;
                break;
        case Opt_sec_ntlmv2i:
@@ -2412,7 +2413,7 @@ cifs_put_smb_ses(struct cifs_ses *ses)
        int xid;
        struct TCP_Server_Info *server = ses->server;
 
-       cFYI(1, "%s: ses_count=%d\n", __func__, ses->ses_count);
+       cFYI(1, "%s: ses_count=%d", __func__, ses->ses_count);
        spin_lock(&cifs_tcp_ses_lock);
        if (--ses->ses_count > 0) {
                spin_unlock(&cifs_tcp_ses_lock);
@@ -2700,7 +2701,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
        int xid;
        struct cifs_ses *ses = tcon->ses;
 
-       cFYI(1, "%s: tc_count=%d\n", __func__, tcon->tc_count);
+       cFYI(1, "%s: tc_count=%d", __func__, tcon->tc_count);
        spin_lock(&cifs_tcp_ses_lock);
        if (--tcon->tc_count > 0) {
                spin_unlock(&cifs_tcp_ses_lock);
@@ -3009,11 +3010,11 @@ bind_socket(struct TCP_Server_Info *server)
                        saddr6 = (struct sockaddr_in6 *)&server->srcaddr;
                        if (saddr6->sin6_family == AF_INET6)
                                cERROR(1, "cifs: "
-                                      "Failed to bind to: %pI6c, error: %d\n",
+                                      "Failed to bind to: %pI6c, error: %d",
                                       &saddr6->sin6_addr, rc);
                        else
                                cERROR(1, "cifs: "
-                                      "Failed to bind to: %pI4, error: %d\n",
+                                      "Failed to bind to: %pI4, error: %d",
                                       &saddr4->sin_addr.s_addr, rc);
                }
        }
@@ -3304,9 +3305,9 @@ void reset_cifs_unix_caps(int xid, struct cifs_tcon *tcon,
                                cFYI(1, "resetting capabilities failed");
                        } else
                                cERROR(1, "Negotiating Unix capabilities "
-                                          "with the server failed.  Consider "
-                                          "mounting with the Unix Extensions\n"
-                                          "disabled, if problems are found, "
+                                          "with the server failed. Consider "
+                                          "mounting with the Unix Extensions "
+                                          "disabled if problems are found "
                                           "by specifying the nounix mount "
                                           "option.");
 
@@ -3445,6 +3446,18 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
 #define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024)
 #define CIFS_DEFAULT_NON_POSIX_WSIZE (65536)
 
+/*
+ * On hosts with high memory, we can't currently support wsize/rsize that are
+ * larger than we can kmap at once. Cap the rsize/wsize at
+ * LAST_PKMAP * PAGE_SIZE. We'll never be able to fill a read or write request
+ * larger than that anyway.
+ */
+#ifdef CONFIG_HIGHMEM
+#define CIFS_KMAP_SIZE_LIMIT   (LAST_PKMAP * PAGE_CACHE_SIZE)
+#else /* CONFIG_HIGHMEM */
+#define CIFS_KMAP_SIZE_LIMIT   (1<<24)
+#endif /* CONFIG_HIGHMEM */
+
 static unsigned int
 cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
 {
@@ -3475,6 +3488,9 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
                wsize = min_t(unsigned int, wsize,
                                server->maxBuf - sizeof(WRITE_REQ) + 4);
 
+       /* limit to the amount that we can kmap at once */
+       wsize = min_t(unsigned int, wsize, CIFS_KMAP_SIZE_LIMIT);
+
        /* hard limit of CIFS_MAX_WSIZE */
        wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);
 
@@ -3516,6 +3532,9 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
        if (!(server->capabilities & CAP_LARGE_READ_X))
                rsize = min_t(unsigned int, CIFSMaxBufSize, rsize);
 
+       /* limit to the amount that we can kmap at once */
+       rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT);
+
        /* hard limit of CIFS_MAX_RSIZE */
        rsize = min_t(unsigned int, rsize, CIFS_MAX_RSIZE);