Skip to content

Commit 1199c6c

Browse files
committed
umd: Rename umd_info.cmdline umd_info.driver_name
The only thing supplied in the cmdline today is the driver name so rename the field to clarify the code. As this value is always supplied stop trying to handle the case of a NULL cmdline. Additionally since we now have a name we can count on use the driver_name any place where the code is looking for a name of the binary. v1: https://lkml.kernel.org/r/[email protected] v2: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Greg Kroah-Hartman <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 74be2d3 commit 1199c6c

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

include/linux/usermode_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static inline void exit_umh(struct task_struct *tsk)
1818
#endif
1919

2020
struct umd_info {
21-
const char *cmdline;
21+
const char *driver_name;
2222
struct file *pipe_to_umh;
2323
struct file *pipe_from_umh;
2424
struct list_head list;

kernel/usermode_driver.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ static void umd_cleanup(struct subprocess_info *info)
6767
* @len: length of the blob
6868
* @info: information about usermode process (shouldn't be NULL)
6969
*
70-
* If info->cmdline is set it will be used as command line for the
71-
* user process, else "usermodehelper" is used.
72-
*
7370
* Returns either negative error or zero which indicates success
7471
* in executing a blob of bytes as a usermode process. In such
7572
* case 'struct umd_info *info' is populated with two pipes
@@ -79,15 +76,14 @@ static void umd_cleanup(struct subprocess_info *info)
7976
*/
8077
int fork_usermode_blob(void *data, size_t len, struct umd_info *info)
8178
{
82-
const char *cmdline = (info->cmdline) ? info->cmdline : "usermodehelper";
8379
struct subprocess_info *sub_info;
8480
char **argv = NULL;
8581
struct file *file;
8682
ssize_t written;
8783
loff_t pos = 0;
8884
int err;
8985

90-
file = shmem_kernel_file_setup("", len, 0);
86+
file = shmem_kernel_file_setup(info->driver_name, len, 0);
9187
if (IS_ERR(file))
9288
return PTR_ERR(file);
9389

@@ -100,11 +96,12 @@ int fork_usermode_blob(void *data, size_t len, struct umd_info *info)
10096
}
10197

10298
err = -ENOMEM;
103-
argv = argv_split(GFP_KERNEL, cmdline, NULL);
99+
argv = argv_split(GFP_KERNEL, info->driver_name, NULL);
104100
if (!argv)
105101
goto out;
106102

107-
sub_info = call_usermodehelper_setup("none", argv, NULL, GFP_KERNEL,
103+
sub_info = call_usermodehelper_setup(info->driver_name, argv, NULL,
104+
GFP_KERNEL,
108105
umd_setup, umd_cleanup, info);
109106
if (!sub_info)
110107
goto out;

net/ipv4/bpfilter/sockopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int __init bpfilter_sockopt_init(void)
7070
{
7171
mutex_init(&bpfilter_ops.lock);
7272
bpfilter_ops.stop = true;
73-
bpfilter_ops.info.cmdline = "bpfilter_umh";
73+
bpfilter_ops.info.driver_name = "bpfilter_umh";
7474
bpfilter_ops.info.cleanup = &bpfilter_umh_cleanup;
7575

7676
return 0;

0 commit comments

Comments
 (0)