Commit 22d3d4fb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull CIFS fixes from Steve French:
 "A few misc important cifs fixes, including a fix for a 4.9 regression
  in posix_acl xattr handling"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()
  Call echo service immediately after socket reconnect
  CIFS: Fix BUG() in calc_seckey()
parents ab59d1f4 ae9ebe7c
...@@ -808,7 +808,11 @@ calc_seckey(struct cifs_ses *ses) ...@@ -808,7 +808,11 @@ calc_seckey(struct cifs_ses *ses)
struct crypto_skcipher *tfm_arc4; struct crypto_skcipher *tfm_arc4;
struct scatterlist sgin, sgout; struct scatterlist sgin, sgout;
struct skcipher_request *req; struct skcipher_request *req;
unsigned char sec_key[CIFS_SESS_KEY_SIZE]; /* a nonce */ unsigned char *sec_key;
sec_key = kmalloc(CIFS_SESS_KEY_SIZE, GFP_KERNEL);
if (sec_key == NULL)
return -ENOMEM;
get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE); get_random_bytes(sec_key, CIFS_SESS_KEY_SIZE);
...@@ -816,7 +820,7 @@ calc_seckey(struct cifs_ses *ses) ...@@ -816,7 +820,7 @@ calc_seckey(struct cifs_ses *ses)
if (IS_ERR(tfm_arc4)) { if (IS_ERR(tfm_arc4)) {
rc = PTR_ERR(tfm_arc4); rc = PTR_ERR(tfm_arc4);
cifs_dbg(VFS, "could not allocate crypto API arc4\n"); cifs_dbg(VFS, "could not allocate crypto API arc4\n");
return rc; goto out;
} }
rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response, rc = crypto_skcipher_setkey(tfm_arc4, ses->auth_key.response,
...@@ -854,7 +858,8 @@ calc_seckey(struct cifs_ses *ses) ...@@ -854,7 +858,8 @@ calc_seckey(struct cifs_ses *ses)
out_free_cipher: out_free_cipher:
crypto_free_skcipher(tfm_arc4); crypto_free_skcipher(tfm_arc4);
out:
kfree(sec_key);
return rc; return rc;
} }
......
...@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, ...@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
__u16 rc = 0; __u16 rc = 0;
struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data; struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
struct posix_acl_xattr_header *local_acl = (void *)pACL; struct posix_acl_xattr_header *local_acl = (void *)pACL;
struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
int count; int count;
int i; int i;
...@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, ...@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
return 0; return 0;
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
(struct posix_acl_xattr_entry *)(local_acl + 1));
if (rc != 0) { if (rc != 0) {
/* ACE not converted */ /* ACE not converted */
break; break;
......
...@@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -412,6 +412,9 @@ cifs_reconnect(struct TCP_Server_Info *server)
} }
} while (server->tcpStatus == CifsNeedReconnect); } while (server->tcpStatus == CifsNeedReconnect);
if (server->tcpStatus == CifsNeedNegotiate)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
return rc; return rc;
} }
...@@ -421,17 +424,25 @@ cifs_echo_request(struct work_struct *work) ...@@ -421,17 +424,25 @@ cifs_echo_request(struct work_struct *work)
int rc; int rc;
struct TCP_Server_Info *server = container_of(work, struct TCP_Server_Info *server = container_of(work,
struct TCP_Server_Info, echo.work); struct TCP_Server_Info, echo.work);
unsigned long echo_interval = server->echo_interval; unsigned long echo_interval;
/*
* If we need to renegotiate, set echo interval to zero to
* immediately call echo service where we can renegotiate.
*/
if (server->tcpStatus == CifsNeedNegotiate)
echo_interval = 0;
else
echo_interval = server->echo_interval;
/* /*
* We cannot send an echo if it is disabled or until the * We cannot send an echo if it is disabled.
* NEGOTIATE_PROTOCOL request is done, which is indicated by * Also, no need to ping if we got a response recently.
* server->ops->need_neg() == true. Also, no need to ping if
* we got a response recently.
*/ */
if (server->tcpStatus == CifsNeedReconnect || if (server->tcpStatus == CifsNeedReconnect ||
server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew || server->tcpStatus == CifsExiting ||
server->tcpStatus == CifsNew ||
(server->ops->can_echo && !server->ops->can_echo(server)) || (server->ops->can_echo && !server->ops->can_echo(server)) ||
time_before(jiffies, server->lstrp + echo_interval - HZ)) time_before(jiffies, server->lstrp + echo_interval - HZ))
goto requeue_echo; goto requeue_echo;
...@@ -442,7 +453,7 @@ cifs_echo_request(struct work_struct *work) ...@@ -442,7 +453,7 @@ cifs_echo_request(struct work_struct *work)
server->hostname); server->hostname);
requeue_echo: requeue_echo:
queue_delayed_work(cifsiod_wq, &server->echo, echo_interval); queue_delayed_work(cifsiod_wq, &server->echo, server->echo_interval);
} }
static bool static bool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment