aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/cuse.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/fuse/cuse.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/fuse/cuse.c')
-rw-r--r--fs/fuse/cuse.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index e1f8171278bd..b6cca47f7b07 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -182,6 +182,7 @@ static const struct file_operations cuse_frontend_fops = {
182 .unlocked_ioctl = cuse_file_ioctl, 182 .unlocked_ioctl = cuse_file_ioctl,
183 .compat_ioctl = cuse_file_compat_ioctl, 183 .compat_ioctl = cuse_file_compat_ioctl,
184 .poll = fuse_file_poll, 184 .poll = fuse_file_poll,
185 .llseek = noop_llseek,
185}; 186};
186 187
187 188
@@ -304,7 +305,7 @@ static void cuse_gendev_release(struct device *dev)
304static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) 305static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
305{ 306{
306 struct cuse_conn *cc = fc_to_cc(fc); 307 struct cuse_conn *cc = fc_to_cc(fc);
307 struct cuse_init_out *arg = &req->misc.cuse_init_out; 308 struct cuse_init_out *arg = req->out.args[0].value;
308 struct page *page = req->pages[0]; 309 struct page *page = req->pages[0];
309 struct cuse_devinfo devinfo = { }; 310 struct cuse_devinfo devinfo = { };
310 struct device *dev; 311 struct device *dev;
@@ -383,6 +384,7 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
383 dev_set_uevent_suppress(dev, 0); 384 dev_set_uevent_suppress(dev, 0);
384 kobject_uevent(&dev->kobj, KOBJ_ADD); 385 kobject_uevent(&dev->kobj, KOBJ_ADD);
385out: 386out:
387 kfree(arg);
386 __free_page(page); 388 __free_page(page);
387 return; 389 return;
388 390
@@ -404,6 +406,7 @@ static int cuse_send_init(struct cuse_conn *cc)
404 struct page *page; 406 struct page *page;
405 struct fuse_conn *fc = &cc->fc; 407 struct fuse_conn *fc = &cc->fc;
406 struct cuse_init_in *arg; 408 struct cuse_init_in *arg;
409 void *outarg;
407 410
408 BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE); 411 BUILD_BUG_ON(CUSE_INIT_INFO_MAX > PAGE_SIZE);
409 412
@@ -418,6 +421,10 @@ static int cuse_send_init(struct cuse_conn *cc)
418 if (!page) 421 if (!page)
419 goto err_put_req; 422 goto err_put_req;
420 423
424 outarg = kzalloc(sizeof(struct cuse_init_out), GFP_KERNEL);
425 if (!outarg)
426 goto err_free_page;
427
421 arg = &req->misc.cuse_init_in; 428 arg = &req->misc.cuse_init_in;
422 arg->major = FUSE_KERNEL_VERSION; 429 arg->major = FUSE_KERNEL_VERSION;
423 arg->minor = FUSE_KERNEL_MINOR_VERSION; 430 arg->minor = FUSE_KERNEL_MINOR_VERSION;
@@ -428,7 +435,7 @@ static int cuse_send_init(struct cuse_conn *cc)
428 req->in.args[0].value = arg; 435 req->in.args[0].value = arg;
429 req->out.numargs = 2; 436 req->out.numargs = 2;
430 req->out.args[0].size = sizeof(struct cuse_init_out); 437 req->out.args[0].size = sizeof(struct cuse_init_out);
431 req->out.args[0].value = &req->misc.cuse_init_out; 438 req->out.args[0].value = outarg;
432 req->out.args[1].size = CUSE_INIT_INFO_MAX; 439 req->out.args[1].size = CUSE_INIT_INFO_MAX;
433 req->out.argvar = 1; 440 req->out.argvar = 1;
434 req->out.argpages = 1; 441 req->out.argpages = 1;
@@ -439,6 +446,8 @@ static int cuse_send_init(struct cuse_conn *cc)
439 446
440 return 0; 447 return 0;
441 448
449err_free_page:
450 __free_page(page);
442err_put_req: 451err_put_req:
443 fuse_put_request(fc, req); 452 fuse_put_request(fc, req);
444err: 453err:
@@ -457,7 +466,7 @@ static void cuse_fc_release(struct fuse_conn *fc)
457 * @file: file struct being opened 466 * @file: file struct being opened
458 * 467 *
459 * Userland CUSE server can create a CUSE device by opening /dev/cuse 468 * Userland CUSE server can create a CUSE device by opening /dev/cuse
460 * and replying to the initilaization request kernel sends. This 469 * and replying to the initialization request kernel sends. This
461 * function is responsible for handling CUSE device initialization. 470 * function is responsible for handling CUSE device initialization.
462 * Because the fd opened by this function is used during 471 * Because the fd opened by this function is used during
463 * initialization, this function only creates cuse_conn and sends 472 * initialization, this function only creates cuse_conn and sends