Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a528159 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: fix put_data error handling
  9p: use an IS_ERR test rather than a NULL test
  9p: introduce missing kfree
  9p-trans_fd: fix and clean up module init/exit paths
  9p-trans_fd: don't do fs segment mangling in p9_fd_poll()
  9p-trans_fd: clean up p9_conn_create()
  9p-trans_fd: fix trans_fd::p9_conn_destroy()
  9p: implement proper trans module refcounting and unregistration
parents fb478da5 16ec4700
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -626,7 +626,6 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
	return NULL;

error:
	if (fid)
	p9_client_clunk(fid);

	return ERR_PTR(result);
+1 −0
Original line number Diff line number Diff line
@@ -596,4 +596,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);
int p9_error_init(void);
int p9_errstr2errno(char *, int);
int p9_trans_fd_init(void);
void p9_trans_fd_exit(void);
#endif /* NET_9P_H */
+7 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#ifndef NET_9P_TRANSPORT_H
#define NET_9P_TRANSPORT_H

#include <linux/module.h>

/**
 * enum p9_trans_status - different states of underlying transports
 * @Connected: transport is connected and healthy
@@ -91,9 +93,12 @@ struct p9_trans_module {
	int maxsize;		/* max message size of transport */
	int def;		/* this transport should be default */
	struct p9_trans * (*create)(const char *, char *, int, unsigned char);
	struct module *owner;
};

void v9fs_register_trans(struct p9_trans_module *m);
struct p9_trans_module *v9fs_match_trans(const substring_t *name);
struct p9_trans_module *v9fs_default_trans(void);
void v9fs_unregister_trans(struct p9_trans_module *m);
struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name);
struct p9_trans_module *v9fs_get_default_trans(void);
void v9fs_put_trans(struct p9_trans_module *m);
#endif /* NET_9P_TRANSPORT_H */
+8 −2
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
	int option;
	int ret = 0;

	clnt->trans_mod = v9fs_default_trans();
	clnt->dotu = 1;
	clnt->msize = 8192;

@@ -108,7 +107,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
			clnt->msize = option;
			break;
		case Opt_trans:
			clnt->trans_mod = v9fs_match_trans(&args[0]);
			clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
			break;
		case Opt_legacy:
			clnt->dotu = 0;
@@ -117,6 +116,10 @@ static int parse_opts(char *opts, struct p9_client *clnt)
			continue;
		}
	}

	if (!clnt->trans_mod)
		clnt->trans_mod = v9fs_get_default_trans();

	kfree(options);
	return ret;
}
@@ -150,6 +153,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
	if (!clnt)
		return ERR_PTR(-ENOMEM);

	clnt->trans_mod = NULL;
	clnt->trans = NULL;
	spin_lock_init(&clnt->lock);
	INIT_LIST_HEAD(&clnt->fidlist);
@@ -235,6 +239,8 @@ void p9_client_destroy(struct p9_client *clnt)
		clnt->trans = NULL;
	}

	v9fs_put_trans(clnt->trans_mod);

	list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
		p9_fid_destroy(fid);

+5 −1
Original line number Diff line number Diff line
@@ -451,8 +451,10 @@ p9_put_data(struct cbuf *bufp, const char *data, int count,
		   unsigned char **pdata)
{
	*pdata = buf_alloc(bufp, count);
	if (*pdata == NULL)
		return -ENOMEM;
	memmove(*pdata, data, count);
	return count;
	return 0;
}

static int
@@ -460,6 +462,8 @@ p9_put_user_data(struct cbuf *bufp, const char __user *data, int count,
		   unsigned char **pdata)
{
	*pdata = buf_alloc(bufp, count);
	if (*pdata == NULL)
		return -ENOMEM;
	return copy_from_user(*pdata, data, count);
}

Loading