@@ -402,33 +402,6 @@ struct subprocess_info *call_usermodehelper_setup(const char *path, char **argv,
402
402
}
403
403
EXPORT_SYMBOL (call_usermodehelper_setup );
404
404
405
- struct subprocess_info * call_usermodehelper_setup_file (struct file * file ,
406
- int (* init )(struct subprocess_info * info , struct cred * new ),
407
- void (* cleanup )(struct subprocess_info * info ), void * data )
408
- {
409
- struct subprocess_info * sub_info ;
410
- struct umh_info * info = data ;
411
- const char * cmdline = (info -> cmdline ) ? info -> cmdline : "usermodehelper" ;
412
-
413
- sub_info = kzalloc (sizeof (struct subprocess_info ), GFP_KERNEL );
414
- if (!sub_info )
415
- return NULL ;
416
-
417
- sub_info -> argv = argv_split (GFP_KERNEL , cmdline , NULL );
418
- if (!sub_info -> argv ) {
419
- kfree (sub_info );
420
- return NULL ;
421
- }
422
-
423
- INIT_WORK (& sub_info -> work , call_usermodehelper_exec_work );
424
- sub_info -> path = "none" ;
425
- sub_info -> file = file ;
426
- sub_info -> init = init ;
427
- sub_info -> cleanup = cleanup ;
428
- sub_info -> data = data ;
429
- return sub_info ;
430
- }
431
-
432
405
static int umd_setup (struct subprocess_info * info , struct cred * new )
433
406
{
434
407
struct umh_info * umh_info = info -> data ;
@@ -479,8 +452,6 @@ static void umd_cleanup(struct subprocess_info *info)
479
452
fput (umh_info -> pipe_to_umh );
480
453
fput (umh_info -> pipe_from_umh );
481
454
}
482
-
483
- argv_free (info -> argv );
484
455
}
485
456
486
457
/**
@@ -501,7 +472,9 @@ static void umd_cleanup(struct subprocess_info *info)
501
472
*/
502
473
int fork_usermode_blob (void * data , size_t len , struct umh_info * info )
503
474
{
475
+ const char * cmdline = (info -> cmdline ) ? info -> cmdline : "usermodehelper" ;
504
476
struct subprocess_info * sub_info ;
477
+ char * * argv = NULL ;
505
478
struct file * file ;
506
479
ssize_t written ;
507
480
loff_t pos = 0 ;
@@ -520,18 +493,25 @@ int fork_usermode_blob(void *data, size_t len, struct umh_info *info)
520
493
}
521
494
522
495
err = - ENOMEM ;
523
- sub_info = call_usermodehelper_setup_file (file , umd_setup , umd_cleanup ,
524
- info );
496
+ argv = argv_split (GFP_KERNEL , cmdline , NULL );
497
+ if (!argv )
498
+ goto out ;
499
+
500
+ sub_info = call_usermodehelper_setup ("none" , argv , NULL , GFP_KERNEL ,
501
+ umd_setup , umd_cleanup , info );
525
502
if (!sub_info )
526
503
goto out ;
527
504
505
+ sub_info -> file = file ;
528
506
err = call_usermodehelper_exec (sub_info , UMH_WAIT_EXEC );
529
507
if (!err ) {
530
508
mutex_lock (& umh_list_lock );
531
509
list_add (& info -> list , & umh_list );
532
510
mutex_unlock (& umh_list_lock );
533
511
}
534
512
out :
513
+ if (argv )
514
+ argv_free (argv );
535
515
fput (file );
536
516
return err ;
537
517
}
0 commit comments