linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: a smb2_validate_and_copy_iov failure does not mean the handle is invalid.
@ 2019-03-31 23:53 Ronnie Sahlberg
  2019-04-01 19:24 ` Pavel Shilovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Ronnie Sahlberg @ 2019-03-31 23:53 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Stable, Ronnie Sahlberg

It only means that we do not have a valid cached value for the
file_all_info structure.

CC: Stable <stable@vger.kernel.org>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2ops.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 7cfafac255aa..728437f8c45d 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -733,14 +733,12 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid)
 	qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
 	if (le32_to_cpu(qi_rsp->OutputBufferLength) < sizeof(struct smb2_file_all_info))
 		goto oshr_exit;
-	rc = smb2_validate_and_copy_iov(
+	if (!smb2_validate_and_copy_iov(
 				le16_to_cpu(qi_rsp->OutputBufferOffset),
 				sizeof(struct smb2_file_all_info),
 				&rsp_iov[1], sizeof(struct smb2_file_all_info),
-				(char *)&tcon->crfid.file_all_info);
-	if (rc)
-		goto oshr_exit;
-	tcon->crfid.file_all_info_is_valid = 1;
+				(char *)&tcon->crfid.file_all_info))
+		tcon->crfid.file_all_info_is_valid = 1;
 
  oshr_exit:
 	mutex_unlock(&tcon->crfid.fid_mutex);
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: a smb2_validate_and_copy_iov failure does not mean the handle is invalid.
  2019-03-31 23:53 [PATCH] cifs: a smb2_validate_and_copy_iov failure does not mean the handle is invalid Ronnie Sahlberg
@ 2019-04-01 19:24 ` Pavel Shilovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Shilovsky @ 2019-04-01 19:24 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: linux-cifs, Steve French, Stable

вс, 31 мар. 2019 г. в 16:54, Ronnie Sahlberg <lsahlber@redhat.com>:
>
> It only means that we do not have a valid cached value for the
> file_all_info structure.
>
> CC: Stable <stable@vger.kernel.org>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2ops.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 7cfafac255aa..728437f8c45d 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -733,14 +733,12 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid)
>         qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
>         if (le32_to_cpu(qi_rsp->OutputBufferLength) < sizeof(struct smb2_file_all_info))
>                 goto oshr_exit;
> -       rc = smb2_validate_and_copy_iov(
> +       if (!smb2_validate_and_copy_iov(
>                                 le16_to_cpu(qi_rsp->OutputBufferOffset),
>                                 sizeof(struct smb2_file_all_info),
>                                 &rsp_iov[1], sizeof(struct smb2_file_all_info),
> -                               (char *)&tcon->crfid.file_all_info);
> -       if (rc)
> -               goto oshr_exit;
> -       tcon->crfid.file_all_info_is_valid = 1;
> +                               (char *)&tcon->crfid.file_all_info))
> +               tcon->crfid.file_all_info_is_valid = 1;
>
>   oshr_exit:
>         mutex_unlock(&tcon->crfid.fid_mutex);
> --
> 2.13.6
>

Looks correct.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-01 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-31 23:53 [PATCH] cifs: a smb2_validate_and_copy_iov failure does not mean the handle is invalid Ronnie Sahlberg
2019-04-01 19:24 ` Pavel Shilovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).