From patchwork Mon Nov 27 04:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Mariani X-Patchwork-Id: 13469058 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F0JMx/C2" Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A99CA11B for ; Sun, 26 Nov 2023 20:52:05 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-280351c32afso3361924a91.1 for ; Sun, 26 Nov 2023 20:52:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701060725; x=1701665525; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=qVUcsPlrwME0u9Qs7h+gqjVo/2eH/y9kicIkm+ey17Y=; b=F0JMx/C21F1akWL0cQ8J6eqnPrg9EhDMHxYzGYAd6XlmdCBF7y/8lrBbpHtxr6oY7j sV2egi516dmzME32KcBelCJ2WTWQTYGxSL90b5kCRME9M8484/bgAGaskMZFywxzef+x eRC8Mt4hLzxqUcA/U8Ctc2qKb3YvgZpmX4ce4J94NWt0bWexvD/4HwhSWkrWW7EMnjPd +VkZUBnHaGbZSCZHz43J6eLmW+IEVlpVhbmZ0wg+sy3/EGsZ32A7dU8qyIqEIpnuIegH HyOea7QdlWUIQXwQFg9fMC7THdXMk0QS5aX1tiuhuda5fNK5GA2pDVxsz8CMbSVgTxqR ncQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701060725; x=1701665525; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qVUcsPlrwME0u9Qs7h+gqjVo/2eH/y9kicIkm+ey17Y=; b=ffmxsTsZPLJZLJFn7pnx51i2J9GE9cDP1uyKidNvsOOBCqLaE4Zuaw/4U0GVrph2QY GIBO66o5JfAuTZ8aXT4nxiU+XOy/0EEz7Ft5Co4beBOH3tqmkETCnf5woti/nvZwk2PR 7smS5Ib8eUMwLaRibUANDOSiH1iuPWMH2mm1anH5WTIA/9MQyC4oVhn3UAPzAPQCDACa bNi/HkrVyLgvU+6eU6GAtZIo20BDQnfx9Sy+LL9t6jS6SOnBvrm5jdNaGouZAh7PJQG3 JcYtbJ+3noQo2/Sf1VkNYRZ9x5ZhCke6/XgjiMGgfnFnCmLtDnUtx/wCeU2Oy/KY6GUy wXVw== X-Gm-Message-State: AOJu0Yy6rDGg3lz3G3qlPNOOhuWw1uZyZk8e+POSsvNz3XNQHk8cg0IY Aw4ZCpbgcoRcdo0R+tDV+w+pIf27Hb8= X-Google-Smtp-Source: AGHT+IEanu52AC2HRziGDxBDWT5Eh44EYiFZ+vS3XklucOxhbEpQ6HrI0CVrkocb5rGpvUxraO9NTQ== X-Received: by 2002:a17:90a:1904:b0:27d:1f9f:a57f with SMTP id 4-20020a17090a190400b0027d1f9fa57fmr13108920pjg.32.1701060724946; Sun, 26 Nov 2023 20:52:04 -0800 (PST) Received: from debian (c-73-109-30-110.hsd1.wa.comcast.net. [73.109.30.110]) by smtp.gmail.com with ESMTPSA id t14-20020a17090ad50e00b0028514c397d7sm6464779pju.17.2023.11.26.20.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 20:52:04 -0800 (PST) Date: Sun, 26 Nov 2023 20:52:03 -0800 From: Pierre Mariani To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pierre.mariani@gmail.com Subject: [PATCH 1/4] smb: client: Delete unused value Message-ID: Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline rc does not need to be set to any value in this location as it gets set to other values is all subsequent logical branches before being used. Fixes Coverity 1562035 Unused value. Signed-off-by: Pierre Mariani --- fs/smb/client/connect.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index f896f60c924b..449d56802692 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -1770,7 +1770,6 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, tcp_ses, (struct sockaddr *)&ctx->dstaddr); if (tcp_ses->smbd_conn) { cifs_dbg(VFS, "RDMA transport established\n"); - rc = 0; goto smbd_connected; } else { rc = -ENOENT; From patchwork Mon Nov 27 04:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Mariani X-Patchwork-Id: 13469059 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L2DpjAf1" Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 002EA11B for ; Sun, 26 Nov 2023 20:52:23 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1ce3084c2d1so30583855ad.3 for ; Sun, 26 Nov 2023 20:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701060743; x=1701665543; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=NocJAL7bmIl27EF1+A+zU1qQfSSMxXoshK+2TFsCp7c=; b=L2DpjAf1gzSwPjk85Gj30UVv/d+EMflsBqnGnylPefBQzqUNbNZVM6hDqn20CDQaYd iPPjdx0uGPUm2VwTBVmGjS46FABqa1vh9BktpLqe3kWkIfRufblZMsNRVYoBobz5+Se4 SJZ+uTrEJjht48hRCroHCymtjfyy8+Z1m/QxsNvBIYy9kXfiSQbk4pcqx/XZ2bp47Twv LrfL/8k3tCH8mIYZ2bHiWCdNpO1AESLnPzjzRUfWlFTXPMxwNekTOAm7KvIUeqkENdvn sAKDoBuc3r+V22QxddQZOzQLqaJN3o+dDkaw6VmcXg2kScQFs0Y8Gvxk52tA8h0K3tDl 2XFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701060743; x=1701665543; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NocJAL7bmIl27EF1+A+zU1qQfSSMxXoshK+2TFsCp7c=; b=eKtiAV9YXWf4tYdTT4oGepnHUz3IOVDErQj354pF2RRZMrqhXL7F6EO0sWkofsjFGJ 4iFrhmSgBSmhpRpQSt/rZLsL6SHSk9G1k1FqzWRe+mFGni4wNrudXW+gT7WS6/OzSpEx RvNJPXKWIyquWoBxO3HaMMGpMO5zsakC4cF7ZFctAWPyC2QjjhpVzxWdshRTnItXLnZU HyrCGLaofaMEr3Y2NJOiim8yiih8EeyJXTMjWUofta6O2bXmV+BlXByhFBKXaQhScCFd 9bdLQFiHhIob3K1N1SXdCl+FkyMSLTwpsk/AsHaQBB2gMs+YlbDR2q+vo9xKTGL0FFIH yEbw== X-Gm-Message-State: AOJu0YydjWtBj6IbL3gnaqR3dVUnnjU1jwPLzBKxCnBQdrgPzZ5E2Ui9 GQqiL+ipp98oTRFt8IOdxvA8V8vtIrk= X-Google-Smtp-Source: AGHT+IH9bDZ6m6cyZgED8BiulGW8GR3Wf3MQbptXoQICRCKr4fzd+gGlUhIxTd/TjOtv5vDElMLj+w== X-Received: by 2002:a17:903:32c8:b0:1cc:3544:ea41 with SMTP id i8-20020a17090332c800b001cc3544ea41mr14200595plr.46.1701060743303; Sun, 26 Nov 2023 20:52:23 -0800 (PST) Received: from debian (c-73-109-30-110.hsd1.wa.comcast.net. [73.109.30.110]) by smtp.gmail.com with ESMTPSA id i1-20020a170902c28100b001c739768214sm7294306pld.92.2023.11.26.20.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 20:52:23 -0800 (PST) Date: Sun, 26 Nov 2023 20:52:21 -0800 From: Pierre Mariani To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pierre.mariani@gmail.com Subject: [PATCH 2/4] smb: client: Protect ses->chans update with chan_lock spin lock Message-ID: <234ee19f9706fa55af3bae3e339e39c42d5b0b0a.1701060106.git.pierre.mariani@gmail.com> References: Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Protect the update of ses->chans with chan_lock spin lock as per documentation from cifsglob.h. Fixes Coverity 1561738. Signed-off-by: Pierre Mariani --- fs/smb/client/connect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 449d56802692..0512835f399c 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2055,6 +2055,7 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) spin_unlock(&cifs_tcp_ses_lock); /* close any extra channels */ + spin_lock(&ses->chan_lock); for (i = 1; i < ses->chan_count; i++) { if (ses->chans[i].iface) { kref_put(&ses->chans[i].iface->refcount, release_iface); @@ -2063,11 +2064,14 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) cifs_put_tcp_session(ses->chans[i].server, 0); ses->chans[i].server = NULL; } + spin_unlock(&ses->chan_lock); /* we now account for primary channel in iface->refcount */ if (ses->chans[0].iface) { kref_put(&ses->chans[0].iface->refcount, release_iface); + spin_lock(&ses->chan_lock); ses->chans[0].server = NULL; + spin_unlock(&ses->chan_lock); } sesInfoFree(ses); From patchwork Mon Nov 27 04:52:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Mariani X-Patchwork-Id: 13469060 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xsb56h6y" Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8AE11B for ; Sun, 26 Nov 2023 20:52:41 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6cbb71c3020so3247874b3a.1 for ; Sun, 26 Nov 2023 20:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701060760; x=1701665560; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JwdK+jEr6Ipps30SEjJjB1pVi3bO7y85nSCuPw4Un9I=; b=Xsb56h6y73n4oz39e6GbLsqTnEISbsrFEv/Js/tWr72F+PqsK6D+kGtc9B6eSY4n3B lpgMaFFSz4MC8DUy77Kt4NLGhiB6RM4TImHjFD2MxGgav/esbhCjJPClC7FttqvD43MH 7YGU87oJvONSrnIAV/ddGEys1vaqAjqLdhjJY2rVu/XYzQDtkFkvsKUKmKTNeNQ5OD63 J/sNENFZgS2XughiVhTGlbhFWyeWyDfjUafqdR/e5U2GuYKBH51pIsXbEjyMh9W+86CL XWQ36FxEjDV+3PvbV9Zj5iwgNwdkjd49FYBCVmDQhlirMs4RDrXTzPmU0z9eA1yYalRV UcDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701060760; x=1701665560; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JwdK+jEr6Ipps30SEjJjB1pVi3bO7y85nSCuPw4Un9I=; b=wBPlT5uNNeTBUgRA0+AhxQnnBm54PfWZnetsVAZboKdxVsLatvwwb4NRv95fwLLTfW Bpl8uLEN7drL64324Z4+c6RvTX66nAItfs3+Yc5aiMvP92sLsFsKkMhpNvKWHT1Z7Av0 L9zvOA8gmEZ5PfOJcAmQbPlCLgux9hzY3Jqf4RrE0W56NPF8k0VXn/U4dQWRiELiTcQr 3eQckhWITexuqbh/ZKuN+uYG+BfOcb+b2ZOpTJ69G+McP+KPEP9v0glUD2F8Bo6BB1wa gL0LlqwbzpU4l4W+XHvmyYZpRM8QOzt3Ty922EWK7+DQtPhBxCLpbaD+UbQC6EuSMKq4 XjeA== X-Gm-Message-State: AOJu0YyWBlsuPnQcxW1xe+6VitmFDOd6IWLX0WlaKxLm81cSNo64VpaQ u4kmJGXxrgLzZP1iT5juoz3rxh4Yg5M= X-Google-Smtp-Source: AGHT+IHXSVfYqjHa145rUwYgwEbzYbedA3gsAWhwi3hbGnOq3FfqZFmRA4J4RbISDuLrWqo9Idj59g== X-Received: by 2002:a05:6a20:6a20:b0:18a:d791:6629 with SMTP id p32-20020a056a206a2000b0018ad7916629mr13013222pzk.11.1701060760448; Sun, 26 Nov 2023 20:52:40 -0800 (PST) Received: from debian (c-73-109-30-110.hsd1.wa.comcast.net. [73.109.30.110]) by smtp.gmail.com with ESMTPSA id fd5-20020a056a002e8500b006cbd24d8d0dsm6308203pfb.85.2023.11.26.20.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 20:52:40 -0800 (PST) Date: Sun, 26 Nov 2023 20:52:38 -0800 From: Pierre Mariani To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pierre.mariani@gmail.com Subject: [PATCH 3/4] smb: client: Protect tcon->status with tc_lock spin lock Message-ID: <8ba54b531064f48c90bdac82dfc43efedaaaed71.1701060106.git.pierre.mariani@gmail.com> References: Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Protect the update of tcon->status with tc_lock spin lock as per documentation from cifsglob.h. Fixes Coverity 1560722 Data race condition. Signed-off-by: Pierre Mariani --- fs/smb/client/connect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 0512835f399c..a381c4cdb8c4 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2710,7 +2710,9 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) tcon->nodelete = ctx->nodelete; tcon->local_lease = ctx->local_lease; INIT_LIST_HEAD(&tcon->pending_opens); + spin_lock(&tcon->tc_lock); tcon->status = TID_GOOD; + spin_unlock(&tcon->tc_lock); INIT_DELAYED_WORK(&tcon->query_interfaces, smb2_query_server_interfaces); From patchwork Mon Nov 27 04:52:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Mariani X-Patchwork-Id: 13469061 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EddBnaaL" Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EBA311B for ; Sun, 26 Nov 2023 20:52:59 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5bd306f86a8so2569430a12.0 for ; Sun, 26 Nov 2023 20:52:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701060778; x=1701665578; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BP9yAem4I4lZebSeh8gfMO8NQkE1HVsF4wxWOmIJcrE=; b=EddBnaaLtiMfs7hw3oxjAGrKuM0U3XtwxtXLd3HZPhD9Q0BhbJ8gNrRgz/ajyFtXY7 dK6rPvRVPhw+F2AKh4SfL7q3Y2A3GAz6Hy+LnGfV+1VX7Fq2b5QhK3r8jEfJbN35sy9o DO2QWeNe4wn8VN98oMgiuOWTEyvd+rrDXcbMZ76qUxkpEQsIKHcCV9gm6e72XhdHs52E pFcxXUhPRZh/h9Yagat4NxSUNtqAJThWY3G7p178woduTzE0sI/PDLG6ftYe7VHr2+2Y qBVki536uwok+RUfZTZQRtHUm8S8tmfL0TNE2tYIU26eycPg7TY3EsmHxIXDY/MQQ6DH jGjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701060778; x=1701665578; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BP9yAem4I4lZebSeh8gfMO8NQkE1HVsF4wxWOmIJcrE=; b=eRGIt9J76HmEO2pf2cZP7c+Jc9vB2X7Wx4hSlXwmKRVr779KxPHMKO1lU5F6L45JVq +1jApNAWOl0Ow3Rds5ZwuzUWx/1xxUw8jMzkVGWeHAQFmdfh8SPjXV/FgNiJJ5veVWs0 3FVl0LG07scHk8hZcLGswBpP60bnIZT7qMn9HuxY/40vshyrsb5PiNEPlyC7mfu4Kcqj zqhufg9pdsf1WwFIhxmZ5j/CCM6CICBYtvjjSCLuOYzvCPFqc/TNcZXxQ8RejmFgRG2M xEZXnsiNCyPOAacuQkNKxxG8QoQW1Nky2x6f+yTkwvLza0ZNhkBP5hA3N/H2iycNieZR JdOw== X-Gm-Message-State: AOJu0YxgGjRdgKqD2DC7hUZssrxa6NE+O61sMQjIO+IC7qB4EXs1FFmw O1jEDFox9vbokrpY9Z5iynTn+Wa6Xh4= X-Google-Smtp-Source: AGHT+IHlrutzZCiElxyX/H0HE21qS0h/5gfvkPHb4MaH3PKvEYPyrnJmVuiDUDLJYZRlJLD/XNngQw== X-Received: by 2002:a17:90a:a08e:b0:280:3650:382a with SMTP id r14-20020a17090aa08e00b002803650382amr10295225pjp.16.1701060778390; Sun, 26 Nov 2023 20:52:58 -0800 (PST) Received: from debian (c-73-109-30-110.hsd1.wa.comcast.net. [73.109.30.110]) by smtp.gmail.com with ESMTPSA id nh19-20020a17090b365300b002851466f471sm6541051pjb.31.2023.11.26.20.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 20:52:58 -0800 (PST) Date: Sun, 26 Nov 2023 20:52:56 -0800 From: Pierre Mariani To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, pierre.mariani@gmail.com Subject: [PATCH 4/4] smb: client: Fix checkpatch whitespace errors and warnings Message-ID: References: Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Fixes no-op checkpatch errors and warnings. Signed-off-by: Pierre Mariani --- fs/smb/client/connect.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index a381c4cdb8c4..59f95ea5105e 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -482,6 +482,7 @@ static int reconnect_target_unlocked(struct TCP_Server_Info *server, struct dfs_ static int reconnect_dfs_server(struct TCP_Server_Info *server) { struct dfs_cache_tgt_iterator *target_hint = NULL; + DFS_CACHE_TGT_LIST(tl); int num_targets = 0; int rc = 0; @@ -750,6 +751,7 @@ cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, { struct msghdr smb_msg = {}; struct kvec iov = {.iov_base = buf, .iov_len = to_read}; + iov_iter_kvec(&smb_msg.msg_iter, ITER_DEST, &iov, 1, to_read); return cifs_readv_from_socket(server, &smb_msg); @@ -1400,11 +1402,13 @@ cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs) case AF_INET: { struct sockaddr_in *saddr4 = (struct sockaddr_in *)srcaddr; struct sockaddr_in *vaddr4 = (struct sockaddr_in *)rhs; + return (saddr4->sin_addr.s_addr == vaddr4->sin_addr.s_addr); } case AF_INET6: { struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr; struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs; + return (ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr) && saddr6->sin6_scope_id == vaddr6->sin6_scope_id); } @@ -2605,8 +2609,8 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) rc = -EOPNOTSUPP; goto out_fail; } else { - cifs_dbg(VFS, "Check vers= mount option. SMB3.11 " - "disabled but required for POSIX extensions\n"); + cifs_dbg(VFS, + "Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n"); rc = -EOPNOTSUPP; goto out_fail; } @@ -2751,7 +2755,6 @@ cifs_put_tlink(struct tcon_link *tlink) if (!IS_ERR(tlink_tcon(tlink))) cifs_put_tcon(tlink_tcon(tlink)); kfree(tlink); - return; } static int @@ -2892,6 +2895,7 @@ static inline void cifs_reclassify_socket4(struct socket *sock) { struct sock *sk = sock->sk; + BUG_ON(!sock_allow_reclassification(sk)); sock_lock_init_class_and_name(sk, "slock-AF_INET-CIFS", &cifs_slock_key[0], "sk_lock-AF_INET-CIFS", &cifs_key[0]); @@ -2901,6 +2905,7 @@ static inline void cifs_reclassify_socket6(struct socket *sock) { struct sock *sk = sock->sk; + BUG_ON(!sock_allow_reclassification(sk)); sock_lock_init_class_and_name(sk, "slock-AF_INET6-CIFS", &cifs_slock_key[1], "sk_lock-AF_INET6-CIFS", &cifs_key[1]); @@ -2935,15 +2940,18 @@ static int bind_socket(struct TCP_Server_Info *server) { int rc = 0; + if (server->srcaddr.ss_family != AF_UNSPEC) { /* Bind to the specified local IP address */ struct socket *socket = server->ssocket; + rc = kernel_bind(socket, (struct sockaddr *) &server->srcaddr, sizeof(server->srcaddr)); if (rc < 0) { struct sockaddr_in *saddr4; struct sockaddr_in6 *saddr6; + saddr4 = (struct sockaddr_in *)&server->srcaddr; saddr6 = (struct sockaddr_in6 *)&server->srcaddr; if (saddr6->sin6_family == AF_INET6) @@ -3173,6 +3181,7 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, if (!CIFSSMBQFSUnixInfo(xid, tcon)) { __u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability); + cifs_dbg(FYI, "unix caps which server supports %lld\n", cap); /* * check for reconnect case in which we do not @@ -3676,7 +3685,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, smb_buffer_response = smb_buffer; header_assemble(smb_buffer, SMB_COM_TREE_CONNECT_ANDX, - NULL /*no tid */ , 4 /*wct */ ); + NULL /*no tid */, 4 /*wct */); smb_buffer->Mid = get_next_mid(ses->server); smb_buffer->Uid = ses->Suid; @@ -3695,12 +3704,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, if (ses->server->sign) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; - if (ses->capabilities & CAP_STATUS32) { + if (ses->capabilities & CAP_STATUS32) smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS; - } - if (ses->capabilities & CAP_DFS) { + + if (ses->capabilities & CAP_DFS) smb_buffer->Flags2 |= SMBFLG2_DFS; - } + if (ses->capabilities & CAP_UNICODE) { smb_buffer->Flags2 |= SMBFLG2_UNICODE; length =