aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-20 08:36:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-20 08:36:53 -0700
commit929a8651f42544f2b94ec149dfb2901e0c0ee427 (patch)
treed2bc6f6c2fe64336263ab651c3bc0670ed71a68a
parenta71d6e0d6fe098cda4e5de1ceb202b64f963f60c (diff)
parent8b6427a2a8f7dd43e9208fb33a3b116d66db4979 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: cifs: fix pointer initialization and checks in cifs_follow_symlink (try #4)
-rw-r--r--fs/cifs/cifssmb.c2
-rw-r--r--fs/cifs/link.c52
2 files changed, 27 insertions, 27 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 5759ba53dc9..d06260251c3 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2475,7 +2475,7 @@ querySymLinkRetry:
/* BB FIXME investigate remapping reserved chars here */
*symlinkinfo = cifs_strndup_from_ucs(data_start, count,
is_unicode, nls_codepage);
- if (!symlinkinfo)
+ if (!*symlinkinfo)
rc = -ENOMEM;
}
}
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index ea9d11e3dcb..cd83c53fcbb 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -107,48 +107,48 @@ void *
cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
{
struct inode *inode = direntry->d_inode;
- int rc = -EACCES;
+ int rc = -ENOMEM;
int xid;
char *full_path = NULL;
- char *target_path = ERR_PTR(-ENOMEM);
- struct cifs_sb_info *cifs_sb;
- struct cifsTconInfo *pTcon;
+ char *target_path = NULL;
+ struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+ struct cifsTconInfo *tcon = cifs_sb->tcon;
xid = GetXid();
- full_path = build_path_from_dentry(direntry);
+ /*
+ * For now, we just handle symlinks with unix extensions enabled.
+ * Eventually we should handle NTFS reparse points, and MacOS
+ * symlink support. For instance...
+ *
+ * rc = CIFSSMBQueryReparseLinkInfo(...)
+ *
+ * For now, just return -EACCES when the server doesn't support posix
+ * extensions. Note that we still allow querying symlinks when posix
+ * extensions are manually disabled. We could disable these as well
+ * but there doesn't seem to be any harm in allowing the client to
+ * read them.
+ */
+ if (!(tcon->ses->capabilities & CAP_UNIX)) {
+ rc = -EACCES;
+ goto out;
+ }
+ full_path = build_path_from_dentry(direntry);
if (!full_path)
goto out;
cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
- cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
-
- /* We could change this to:
- if (pTcon->unix_ext)
- but there does not seem any point in refusing to
- get symlink info if we can, even if unix extensions
- turned off for this mount */
-
- if (pTcon->ses->capabilities & CAP_UNIX)
- rc = CIFSSMBUnixQuerySymLink(xid, pTcon, full_path,
- &target_path,
- cifs_sb->local_nls);
- else {
- /* BB add read reparse point symlink code here */
- /* rc = CIFSSMBQueryReparseLinkInfo */
- /* BB Add code to Query ReparsePoint info */
- /* BB Add MAC style xsymlink check here if enabled */
- }
+ rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, &target_path,
+ cifs_sb->local_nls);
+ kfree(full_path);
+out:
if (rc != 0) {
kfree(target_path);
target_path = ERR_PTR(rc);
}
- kfree(full_path);
-out:
FreeXid(xid);
nd_set_link(nd, target_path);
return NULL;