mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 10:43:43 +00:00
new helper: kfree_put_link()
duplicated to hell and back... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
12f3887222
commit
87dc800be2
@ -860,7 +860,7 @@ const struct inode_operations cifs_file_inode_ops = {
|
|||||||
const struct inode_operations cifs_symlink_inode_ops = {
|
const struct inode_operations cifs_symlink_inode_ops = {
|
||||||
.readlink = generic_readlink,
|
.readlink = generic_readlink,
|
||||||
.follow_link = cifs_follow_link,
|
.follow_link = cifs_follow_link,
|
||||||
.put_link = cifs_put_link,
|
.put_link = kfree_put_link,
|
||||||
.permission = cifs_permission,
|
.permission = cifs_permission,
|
||||||
/* BB add the following two eventually */
|
/* BB add the following two eventually */
|
||||||
/* revalidate: cifs_revalidate,
|
/* revalidate: cifs_revalidate,
|
||||||
|
@ -115,8 +115,6 @@ extern struct vfsmount *cifs_dfs_d_automount(struct path *path);
|
|||||||
|
|
||||||
/* Functions related to symlinks */
|
/* Functions related to symlinks */
|
||||||
extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
|
extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
|
||||||
extern void cifs_put_link(struct dentry *direntry,
|
|
||||||
struct nameidata *nd, void *);
|
|
||||||
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
|
extern int cifs_readlink(struct dentry *direntry, char __user *buffer,
|
||||||
int buflen);
|
int buflen);
|
||||||
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
|
extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
|
||||||
|
@ -621,10 +621,3 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
|
|||||||
free_xid(xid);
|
free_xid(xid);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cifs_put_link(struct dentry *direntry, struct nameidata *nd, void *cookie)
|
|
||||||
{
|
|
||||||
char *p = nd_get_link(nd);
|
|
||||||
if (!IS_ERR(p))
|
|
||||||
kfree(p);
|
|
||||||
}
|
|
||||||
|
@ -703,16 +703,6 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ecryptfs_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
|
|
||||||
{
|
|
||||||
char *buf = nd_get_link(nd);
|
|
||||||
if (!IS_ERR(buf)) {
|
|
||||||
/* Free the char* */
|
|
||||||
kfree(buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* upper_size_to_lower_size
|
* upper_size_to_lower_size
|
||||||
* @crypt_stat: Crypt_stat associated with file
|
* @crypt_stat: Crypt_stat associated with file
|
||||||
@ -1121,7 +1111,7 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name)
|
|||||||
const struct inode_operations ecryptfs_symlink_iops = {
|
const struct inode_operations ecryptfs_symlink_iops = {
|
||||||
.readlink = generic_readlink,
|
.readlink = generic_readlink,
|
||||||
.follow_link = ecryptfs_follow_link,
|
.follow_link = ecryptfs_follow_link,
|
||||||
.put_link = ecryptfs_put_link,
|
.put_link = kfree_put_link,
|
||||||
.permission = ecryptfs_permission,
|
.permission = ecryptfs_permission,
|
||||||
.setattr = ecryptfs_setattr,
|
.setattr = ecryptfs_setattr,
|
||||||
.getattr = ecryptfs_getattr_link,
|
.getattr = ecryptfs_getattr_link,
|
||||||
|
@ -1506,13 +1506,6 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfs2_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
|
|
||||||
{
|
|
||||||
char *s = nd_get_link(nd);
|
|
||||||
if (!IS_ERR(s))
|
|
||||||
kfree(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gfs2_permission -
|
* gfs2_permission -
|
||||||
* @inode: The inode
|
* @inode: The inode
|
||||||
@ -1864,7 +1857,7 @@ const struct inode_operations gfs2_dir_iops = {
|
|||||||
const struct inode_operations gfs2_symlink_iops = {
|
const struct inode_operations gfs2_symlink_iops = {
|
||||||
.readlink = generic_readlink,
|
.readlink = generic_readlink,
|
||||||
.follow_link = gfs2_follow_link,
|
.follow_link = gfs2_follow_link,
|
||||||
.put_link = gfs2_put_link,
|
.put_link = kfree_put_link,
|
||||||
.permission = gfs2_permission,
|
.permission = gfs2_permission,
|
||||||
.setattr = gfs2_setattr,
|
.setattr = gfs2_setattr,
|
||||||
.getattr = gfs2_getattr,
|
.getattr = gfs2_getattr,
|
||||||
|
10
fs/libfs.c
10
fs/libfs.c
@ -10,6 +10,7 @@
|
|||||||
#include <linux/vfs.h>
|
#include <linux/vfs.h>
|
||||||
#include <linux/quotaops.h>
|
#include <linux/quotaops.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/namei.h>
|
||||||
#include <linux/exportfs.h>
|
#include <linux/exportfs.h>
|
||||||
#include <linux/writeback.h>
|
#include <linux/writeback.h>
|
||||||
#include <linux/buffer_head.h> /* sync_mapping_buffers */
|
#include <linux/buffer_head.h> /* sync_mapping_buffers */
|
||||||
@ -992,3 +993,12 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(noop_fsync);
|
EXPORT_SYMBOL(noop_fsync);
|
||||||
|
|
||||||
|
void kfree_put_link(struct dentry *dentry, struct nameidata *nd,
|
||||||
|
void *cookie)
|
||||||
|
{
|
||||||
|
char *s = nd_get_link(nd);
|
||||||
|
if (!IS_ERR(s))
|
||||||
|
kfree(s);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(kfree_put_link);
|
||||||
|
@ -36,18 +36,10 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
|
|
||||||
void *cookie)
|
|
||||||
{
|
|
||||||
char *s = nd_get_link(nd);
|
|
||||||
if (!IS_ERR(s))
|
|
||||||
kfree(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct inode_operations proc_self_inode_operations = {
|
static const struct inode_operations proc_self_inode_operations = {
|
||||||
.readlink = proc_self_readlink,
|
.readlink = proc_self_readlink,
|
||||||
.follow_link = proc_self_follow_link,
|
.follow_link = proc_self_follow_link,
|
||||||
.put_link = proc_self_put_link,
|
.put_link = kfree_put_link,
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned self_inum;
|
static unsigned self_inum;
|
||||||
|
@ -2502,6 +2502,7 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
|
|||||||
int nofs);
|
int nofs);
|
||||||
extern int page_symlink(struct inode *inode, const char *symname, int len);
|
extern int page_symlink(struct inode *inode, const char *symname, int len);
|
||||||
extern const struct inode_operations page_symlink_inode_operations;
|
extern const struct inode_operations page_symlink_inode_operations;
|
||||||
|
extern void kfree_put_link(struct dentry *, struct nameidata *, void *);
|
||||||
extern int generic_readlink(struct dentry *, char __user *, int);
|
extern int generic_readlink(struct dentry *, char __user *, int);
|
||||||
extern void generic_fillattr(struct inode *, struct kstat *);
|
extern void generic_fillattr(struct inode *, struct kstat *);
|
||||||
extern int vfs_getattr(struct path *, struct kstat *);
|
extern int vfs_getattr(struct path *, struct kstat *);
|
||||||
|
Loading…
Reference in New Issue
Block a user