diff options
Diffstat (limited to 'fs/ncpfs/inode.c')
-rw-r--r-- | fs/ncpfs/inode.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 47462ac94474..67a90bf795d5 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -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; |
396 | err: | ||
397 | put_pid(data->wdog_pid); | ||
398 | data->wdog_pid = NULL; | ||
399 | return ret; | ||
395 | } | 400 | } |
396 | 401 | ||
397 | static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | 402 | static 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; |
@@ -679,6 +685,7 @@ out_fput: | |||
679 | */ | 685 | */ |
680 | fput(ncp_filp); | 686 | fput(ncp_filp); |
681 | out: | 687 | out: |
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); |