Merge tag '6.6-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

- protect cifs/smb3 socket connect from BPF address overwrite

- fix case when directory leases disabled but wasting resources with
unneeded thread on each mount

* tag '6.6-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
smb: client: do not start laundromat thread on nohandlecache
smb: use kernel_connect() and kernel_bind()

Changed files
+13 -13
fs
smb
client
+13 -13
fs/smb/client/connect.c
··· 2474 2474 static struct cifs_tcon * 2475 2475 cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) 2476 2476 { 2477 - int rc, xid; 2478 2477 struct cifs_tcon *tcon; 2478 + bool nohandlecache; 2479 + int rc, xid; 2479 2480 2480 2481 tcon = cifs_find_tcon(ses, ctx); 2481 2482 if (tcon) { ··· 2494 2493 goto out_fail; 2495 2494 } 2496 2495 2497 - if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) 2498 - tcon = tcon_info_alloc(true); 2496 + if (ses->server->dialect >= SMB20_PROT_ID && 2497 + (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)) 2498 + nohandlecache = ctx->nohandlecache; 2499 2499 else 2500 - tcon = tcon_info_alloc(false); 2500 + nohandlecache = true; 2501 + tcon = tcon_info_alloc(!nohandlecache); 2501 2502 if (tcon == NULL) { 2502 2503 rc = -ENOMEM; 2503 2504 goto out_fail; 2504 2505 } 2506 + tcon->nohandlecache = nohandlecache; 2505 2507 2506 2508 if (ctx->snapshot_time) { 2507 2509 if (ses->server->vals->protocol_id == 0) { ··· 2666 2662 tcon->nocase = ctx->nocase; 2667 2663 tcon->broken_sparse_sup = ctx->no_sparse; 2668 2664 tcon->max_cached_dirs = ctx->max_cached_dirs; 2669 - if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) 2670 - tcon->nohandlecache = ctx->nohandlecache; 2671 - else 2672 - tcon->nohandlecache = true; 2673 2665 tcon->nodelete = ctx->nodelete; 2674 2666 tcon->local_lease = ctx->local_lease; 2675 2667 INIT_LIST_HEAD(&tcon->pending_opens); ··· 2895 2895 if (server->srcaddr.ss_family != AF_UNSPEC) { 2896 2896 /* Bind to the specified local IP address */ 2897 2897 struct socket *socket = server->ssocket; 2898 - rc = socket->ops->bind(socket, 2899 - (struct sockaddr *) &server->srcaddr, 2900 - sizeof(server->srcaddr)); 2898 + rc = kernel_bind(socket, 2899 + (struct sockaddr *) &server->srcaddr, 2900 + sizeof(server->srcaddr)); 2901 2901 if (rc < 0) { 2902 2902 struct sockaddr_in *saddr4; 2903 2903 struct sockaddr_in6 *saddr6; ··· 3046 3046 socket->sk->sk_sndbuf, 3047 3047 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo); 3048 3048 3049 - rc = socket->ops->connect(socket, saddr, slen, 3050 - server->noblockcnt ? O_NONBLOCK : 0); 3049 + rc = kernel_connect(socket, saddr, slen, 3050 + server->noblockcnt ? O_NONBLOCK : 0); 3051 3051 /* 3052 3052 * When mounting SMB root file systems, we do not want to block in 3053 3053 * connect. Otherwise bail out and then let cifs_reconnect() perform