* [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it
@ 2013-07-22 19:24 Andi Shyti
2013-07-22 19:26 ` Andi Shyti
0 siblings, 1 reply; 4+ messages in thread
From: Andi Shyti @ 2013-07-22 19:24 UTC (permalink / raw)
To: sfrench; +Cc: linux-cifs, samba-technical, linux-kernel, andi
In the cifs_reopen_file function, if the following statement is
asserted:
(tcon->unix_ext && cap_unix(tcon->ses) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
(tcon->fsUnixInfo.Capability)))
and we succeed to open with cifs_posix_open, the function jumps
to the label reopen_success and checks for oparms.reconnect
which is not initialized.
To avoid this the oparms structure initialization is anticipated
before the if statement.
Signed-off-by: Andi Shyti <andi@etezian.org>
---
fs/cifs/file.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1e57f36..fbeaf45 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -632,6 +632,15 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
else
oplock = 0;
+ oparms.tcon = tcon;
+ oparms.cifs_sb = cifs_sb;
+ oparms.desired_access = desired_access;
+ oparms.create_options = create_options;
+ oparms.disposition = disposition;
+ oparms.path = full_path;
+ oparms.fid = &cfile->fid;
+ oparms.reconnect = true;
+
if (tcon->unix_ext && cap_unix(tcon->ses) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) {
@@ -663,15 +672,6 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
if (server->ops->get_lease_key)
server->ops->get_lease_key(inode, &cfile->fid);
- oparms.tcon = tcon;
- oparms.cifs_sb = cifs_sb;
- oparms.desired_access = desired_access;
- oparms.create_options = create_options;
- oparms.disposition = disposition;
- oparms.path = full_path;
- oparms.fid = &cfile->fid;
- oparms.reconnect = true;
-
/*
* Can not refresh inode by passing in file_info buf to be returned by
* CIFSSMBOpen and then calling get_inode_info with returned buf since
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it
2013-07-22 19:24 Andi Shyti
@ 2013-07-22 19:26 ` Andi Shyti
0 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2013-07-22 19:26 UTC (permalink / raw)
To: sfrench; +Cc: linux-cifs, samba-technical, linux-kernel
This is patch 1/1, not 2/2... messed up with git.
Andi
On Mon, Jul 22, 2013 at 09:24:00PM +0200, Andi Shyti wrote:
> In the cifs_reopen_file function, if the following statement is
> asserted:
>
> (tcon->unix_ext && cap_unix(tcon->ses) &&
> (CIFS_UNIX_POSIX_PATH_OPS_CAP &
> (tcon->fsUnixInfo.Capability)))
>
> and we succeed to open with cifs_posix_open, the function jumps
> to the label reopen_success and checks for oparms.reconnect
> which is not initialized.
>
> To avoid this the oparms structure initialization is anticipated
> before the if statement.
>
> Signed-off-by: Andi Shyti <andi@etezian.org>
> ---
> fs/cifs/file.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 1e57f36..fbeaf45 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -632,6 +632,15 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
> else
> oplock = 0;
>
> + oparms.tcon = tcon;
> + oparms.cifs_sb = cifs_sb;
> + oparms.desired_access = desired_access;
> + oparms.create_options = create_options;
> + oparms.disposition = disposition;
> + oparms.path = full_path;
> + oparms.fid = &cfile->fid;
> + oparms.reconnect = true;
> +
> if (tcon->unix_ext && cap_unix(tcon->ses) &&
> (CIFS_UNIX_POSIX_PATH_OPS_CAP &
> le64_to_cpu(tcon->fsUnixInfo.Capability))) {
> @@ -663,15 +672,6 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
> if (server->ops->get_lease_key)
> server->ops->get_lease_key(inode, &cfile->fid);
>
> - oparms.tcon = tcon;
> - oparms.cifs_sb = cifs_sb;
> - oparms.desired_access = desired_access;
> - oparms.create_options = create_options;
> - oparms.disposition = disposition;
> - oparms.path = full_path;
> - oparms.fid = &cfile->fid;
> - oparms.reconnect = true;
> -
> /*
> * Can not refresh inode by passing in file_info buf to be returned by
> * CIFSSMBOpen and then calling get_inode_info with returned buf since
> --
> 1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it
@ 2013-07-29 3:40 Steve French
2013-07-29 8:33 ` Andi Shyti
0 siblings, 1 reply; 4+ messages in thread
From: Steve French @ 2013-07-29 3:40 UTC (permalink / raw)
To: LKML, linux-cifs, Andi Shyti, mikko.rapeli
Andi,
Your patch looks reasonable. Would you repost the patch to
linux-cifs mailing list (and add any additional reviewers or testers
if you would like if you got feedback)?
On Mon, Jul 22, 2013 at 09:24:00PM +0200, Andi Shyti wrote:
In the cifs_reopen_file function, if the following statement is
asserted:
(tcon->unix_ext && cap_unix(tcon->ses) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
(tcon->fsUnixInfo.Capability)))
and we succeed to open with cifs_posix_open, the function jumps
to the label reopen_success and checks for oparms.reconnect
which is not initialized.
To avoid this the oparms structure initialization is anticipated
before the if statement.
Signed-off-by: Andi Shyti
fs/cifs/file.c | 18 +++++++++
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1e57f36..fbeaf45 100644
a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -632,6 +632,15 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool
can_flush)
else
oplock = 0;
+ oparms.tcon = tcon;
+ oparms.cifs_sb = cifs_sb;
+ oparms.desired_access = desired_access;
+ oparms.create_options = create_options;
+ oparms.disposition = disposition;
+ oparms.path = full_path;
+ oparms.fid = &cfile->fid;
+ oparms.reconnect = true;
+
if (tcon->unix_ext && cap_unix(tcon->ses) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) {
@@ -663,15 +672,6 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool
can_flush)
if (server->ops->get_lease_key)
server->ops->get_lease_key(inode, &cfile->fid);
- oparms.tcon = tcon;
- oparms.cifs_sb = cifs_sb;
- oparms.desired_access = desired_access;
- oparms.create_options = create_options;
- oparms.disposition = disposition;
- oparms.path = full_path;
- oparms.fid = &cfile->fid;
- oparms.reconnect = true;
-
/*
* Can not refresh inode by passing in file_info buf to be returned by
* CIFSSMBOpen and then calling get_inode_info with returned buf sinc
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it
2013-07-29 3:40 [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it Steve French
@ 2013-07-29 8:33 ` Andi Shyti
0 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2013-07-29 8:33 UTC (permalink / raw)
To: Steve French; +Cc: LKML, linux-cifs, Andi Shyti, mikko.rapeli
Hi Steve,
> Your patch looks reasonable. Would you repost the patch to
> linux-cifs mailing list (and add any additional reviewers or testers
> if you would like if you got feedback)?
Thanks for your mail,
Actually linux-cifs is on CC and this is the output of
get_maintainer:
Steve French <sfrench@samba.org> (supporter:COMMON INTERNET F...)
linux-cifs@vger.kernel.org (open list:COMMON INTERNET F...)
samba-technical@lists.samba.org (moderated list:COMMON INTERNET F...)
linux-kernel@vger.kernel.org (open list)
All are on CC. get_maintainers, indeed sometimes is not very
precise since gets the CC list by doing a git blame on the file
and adding the ones who previously modified the specific lines.
If this patch got lost I could enrich my To/Cc list by looking at
git shortlog and more carefully at git blame.
Thanks,
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-29 8:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 3:40 [PATCH 2/2] cifs: file: initialize oparms.reconnect before using it Steve French
2013-07-29 8:33 ` Andi Shyti
-- strict thread matches above, loose matches on Subject: below --
2013-07-22 19:24 Andi Shyti
2013-07-22 19:26 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox