aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ncpfs/inode.c')
-rw-r--r--fs/ncpfs/inode.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 42e3bef270c9..67a90bf795d5 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -40,12 +40,12 @@ static void ncp_delete_inode(struct inode *);
40static void ncp_put_super(struct super_block *); 40static void ncp_put_super(struct super_block *);
41static int ncp_statfs(struct dentry *, struct kstatfs *); 41static int ncp_statfs(struct dentry *, struct kstatfs *);
42 42
43static kmem_cache_t * ncp_inode_cachep; 43static struct kmem_cache * ncp_inode_cachep;
44 44
45static struct inode *ncp_alloc_inode(struct super_block *sb) 45static struct inode *ncp_alloc_inode(struct super_block *sb)
46{ 46{
47 struct ncp_inode_info *ei; 47 struct ncp_inode_info *ei;
48 ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, SLAB_KERNEL); 48 ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
49 if (!ei) 49 if (!ei)
50 return NULL; 50 return NULL;
51 return &ei->vfs_inode; 51 return &ei->vfs_inode;
@@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode)); 56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
57} 57}
58 58
59static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 59static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
60{ 60{
61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; 61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
62 62
@@ -327,11 +327,12 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
327 char *optarg; 327 char *optarg;
328 unsigned long optint; 328 unsigned long optint;
329 int version = 0; 329 int version = 0;
330 int ret;
330 331
331 data->flags = 0; 332 data->flags = 0;
332 data->int_flags = 0; 333 data->int_flags = 0;
333 data->mounted_uid = 0; 334 data->mounted_uid = 0;
334 data->wdog_pid = -1; 335 data->wdog_pid = NULL;
335 data->ncp_fd = ~0; 336 data->ncp_fd = ~0;
336 data->time_out = 10; 337 data->time_out = 10;
337 data->retry_count = 20; 338 data->retry_count = 20;
@@ -343,8 +344,9 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
343 data->mounted_vol[0] = 0; 344 data->mounted_vol[0] = 0;
344 345
345 while ((optval = ncp_getopt("ncpfs", &options, ncp_opts, NULL, &optarg, &optint)) != 0) { 346 while ((optval = ncp_getopt("ncpfs", &options, ncp_opts, NULL, &optarg, &optint)) != 0) {
346 if (optval < 0) 347 ret = optval;
347 return optval; 348 if (ret < 0)
349 goto err;
348 switch (optval) { 350 switch (optval) {
349 case 'u': 351 case 'u':
350 data->uid = optint; 352 data->uid = optint;
@@ -371,7 +373,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
371 data->flags = optint; 373 data->flags = optint;
372 break; 374 break;
373 case 'w': 375 case 'w':
374 data->wdog_pid = optint; 376 data->wdog_pid = find_get_pid(optint);
375 break; 377 break;
376 case 'n': 378 case 'n':
377 data->ncp_fd = optint; 379 data->ncp_fd = optint;
@@ -380,18 +382,21 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
380 data->info_fd = optint; 382 data->info_fd = optint;
381 break; 383 break;
382 case 'v': 384 case 'v':
383 if (optint < NCP_MOUNT_VERSION_V4) { 385 ret = -ECHRNG;
384 return -ECHRNG; 386 if (optint < NCP_MOUNT_VERSION_V4)
385 } 387 goto err;
386 if (optint > NCP_MOUNT_VERSION_V5) { 388 if (optint > NCP_MOUNT_VERSION_V5)
387 return -ECHRNG; 389 goto err;
388 }
389 version = optint; 390 version = optint;
390 break; 391 break;
391 392
392 } 393 }
393 } 394 }
394 return 0; 395 return 0;
396err:
397 put_pid(data->wdog_pid);
398 data->wdog_pid = NULL;
399 return ret;
395} 400}
396 401
397static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) 402static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
@@ -409,6 +414,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
409#endif 414#endif
410 struct ncp_entry_info finfo; 415 struct ncp_entry_info finfo;
411 416
417 data.wdog_pid = NULL;
412 server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL); 418 server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL);
413 if (!server) 419 if (!server)
414 return -ENOMEM; 420 return -ENOMEM;
@@ -425,7 +431,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
425 data.flags = md->flags; 431 data.flags = md->flags;
426 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; 432 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE;
427 data.mounted_uid = md->mounted_uid; 433 data.mounted_uid = md->mounted_uid;
428 data.wdog_pid = md->wdog_pid; 434 data.wdog_pid = find_get_pid(md->wdog_pid);
429 data.ncp_fd = md->ncp_fd; 435 data.ncp_fd = md->ncp_fd;
430 data.time_out = md->time_out; 436 data.time_out = md->time_out;
431 data.retry_count = md->retry_count; 437 data.retry_count = md->retry_count;
@@ -445,7 +451,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
445 data.flags = md->flags; 451 data.flags = md->flags;
446 data.int_flags = 0; 452 data.int_flags = 0;
447 data.mounted_uid = md->mounted_uid; 453 data.mounted_uid = md->mounted_uid;
448 data.wdog_pid = md->wdog_pid; 454 data.wdog_pid = find_get_pid(md->wdog_pid);
449 data.ncp_fd = md->ncp_fd; 455 data.ncp_fd = md->ncp_fd;
450 data.time_out = md->time_out; 456 data.time_out = md->time_out;
451 data.retry_count = md->retry_count; 457 data.retry_count = md->retry_count;
@@ -471,7 +477,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
471 if (!ncp_filp) 477 if (!ncp_filp)
472 goto out; 478 goto out;
473 error = -ENOTSOCK; 479 error = -ENOTSOCK;
474 sock_inode = ncp_filp->f_dentry->d_inode; 480 sock_inode = ncp_filp->f_path.dentry->d_inode;
475 if (!S_ISSOCK(sock_inode->i_mode)) 481 if (!S_ISSOCK(sock_inode->i_mode))
476 goto out_fput; 482 goto out_fput;
477 sock = SOCKET_I(sock_inode); 483 sock = SOCKET_I(sock_inode);
@@ -504,7 +510,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
504 if (!server->info_filp) 510 if (!server->info_filp)
505 goto out_fput; 511 goto out_fput;
506 error = -ENOTSOCK; 512 error = -ENOTSOCK;
507 sock_inode = server->info_filp->f_dentry->d_inode; 513 sock_inode = server->info_filp->f_path.dentry->d_inode;
508 if (!S_ISSOCK(sock_inode->i_mode)) 514 if (!S_ISSOCK(sock_inode->i_mode))
509 goto out_fput2; 515 goto out_fput2;
510 info_sock = SOCKET_I(sock_inode); 516 info_sock = SOCKET_I(sock_inode);
@@ -577,12 +583,12 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
577 server->rcv.ptr = (unsigned char*)&server->rcv.buf; 583 server->rcv.ptr = (unsigned char*)&server->rcv.buf;
578 server->rcv.len = 10; 584 server->rcv.len = 10;
579 server->rcv.state = 0; 585 server->rcv.state = 0;
580 INIT_WORK(&server->rcv.tq, ncp_tcp_rcv_proc, server); 586 INIT_WORK(&server->rcv.tq, ncp_tcp_rcv_proc);
581 INIT_WORK(&server->tx.tq, ncp_tcp_tx_proc, server); 587 INIT_WORK(&server->tx.tq, ncp_tcp_tx_proc);
582 sock->sk->sk_write_space = ncp_tcp_write_space; 588 sock->sk->sk_write_space = ncp_tcp_write_space;
583 } else { 589 } else {
584 INIT_WORK(&server->rcv.tq, ncpdgram_rcv_proc, server); 590 INIT_WORK(&server->rcv.tq, ncpdgram_rcv_proc);
585 INIT_WORK(&server->timeout_tq, ncpdgram_timeout_proc, server); 591 INIT_WORK(&server->timeout_tq, ncpdgram_timeout_proc);
586 server->timeout_tm.data = (unsigned long)server; 592 server->timeout_tm.data = (unsigned long)server;
587 server->timeout_tm.function = ncpdgram_timeout_call; 593 server->timeout_tm.function = ncpdgram_timeout_call;
588 } 594 }
@@ -679,6 +685,7 @@ out_fput:
679 */ 685 */
680 fput(ncp_filp); 686 fput(ncp_filp);
681out: 687out:
688 put_pid(data.wdog_pid);
682 sb->s_fs_info = NULL; 689 sb->s_fs_info = NULL;
683 kfree(server); 690 kfree(server);
684 return error; 691 return error;
@@ -711,7 +718,8 @@ static void ncp_put_super(struct super_block *sb)
711 if (server->info_filp) 718 if (server->info_filp)
712 fput(server->info_filp); 719 fput(server->info_filp);
713 fput(server->ncp_filp); 720 fput(server->ncp_filp);
714 kill_proc(server->m.wdog_pid, SIGTERM, 1); 721 kill_pid(server->m.wdog_pid, SIGTERM, 1);
722 put_pid(server->m.wdog_pid);
715 723
716 kfree(server->priv.data); 724 kfree(server->priv.data);
717 kfree(server->auth.object_name); 725 kfree(server->auth.object_name);