aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-12-11 12:00:43 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-19 06:59:45 -0500
commit377e7a27c049d6df9c1804454904e438ed12f1a4 (patch)
tree4d954cde851170e98fea196869de609815306410
parent6d2c5d6c46dd3d9924831efd6c913fdf4d484985 (diff)
Make static usermode helper binaries constant
There are a number of usermode helper binaries that are "hard coded" in the kernel today, so mark them as "const" to make it harder for someone to change where the variables point to. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Sailer <t.sailer@alumni.ethz.ch> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Johan Hovold <johan@kernel.org> Cc: Alex Elder <elder@kernel.org> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Jeff Layton <jlayton@poochiereds.net> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/macintosh/windfarm_core.c4
-rw-r--r--drivers/net/hamradio/baycom_epp.c10
-rw-r--r--drivers/pnp/pnpbios/core.c5
-rw-r--r--drivers/staging/greybus/svc_watchdog.c4
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/rtl_dm.c8
-rw-r--r--fs/nfsd/nfs4layouts.c6
-rw-r--r--security/keys/request_key.c7
7 files changed, 26 insertions, 18 deletions
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 465d770ab0bb..5e013d781a74 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -74,8 +74,8 @@ static inline void wf_notify(int event, void *param)
74 74
75static int wf_critical_overtemp(void) 75static int wf_critical_overtemp(void)
76{ 76{
77 static char * critical_overtemp_path = "/sbin/critical_overtemp"; 77 static char const critical_overtemp_path[] = "/sbin/critical_overtemp";
78 char *argv[] = { critical_overtemp_path, NULL }; 78 char *argv[] = { (char *)critical_overtemp_path, NULL };
79 static char *envp[] = { "HOME=/", 79 static char *envp[] = { "HOME=/",
80 "TERM=linux", 80 "TERM=linux",
81 "PATH=/sbin:/usr/sbin:/bin:/usr/bin", 81 "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 7d054697b199..594fa1407e29 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -299,7 +299,7 @@ static inline void baycom_int_freq(struct baycom_state *bc)
299 * eppconfig_path should be setable via /proc/sys. 299 * eppconfig_path should be setable via /proc/sys.
300 */ 300 */
301 301
302static char eppconfig_path[256] = "/usr/sbin/eppfpga"; 302static char const eppconfig_path[] = "/usr/sbin/eppfpga";
303 303
304static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL }; 304static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL };
305 305
@@ -308,8 +308,12 @@ static int eppconfig(struct baycom_state *bc)
308{ 308{
309 char modearg[256]; 309 char modearg[256];
310 char portarg[16]; 310 char portarg[16];
311 char *argv[] = { eppconfig_path, "-s", "-p", portarg, "-m", modearg, 311 char *argv[] = {
312 NULL }; 312 (char *)eppconfig_path,
313 "-s",
314 "-p", portarg,
315 "-m", modearg,
316 NULL };
313 317
314 /* set up arguments */ 318 /* set up arguments */
315 sprintf(modearg, "%sclk,%smodem,fclk=%d,bps=%d,divider=%d%s,extstat", 319 sprintf(modearg, "%sclk,%smodem,fclk=%d,bps=%d,divider=%d%s,extstat",
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index c38a5b9733c8..0ced908e7aa8 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -98,6 +98,7 @@ static struct completion unload_sem;
98 */ 98 */
99static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) 99static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
100{ 100{
101 static char const sbin_pnpbios[] = "/sbin/pnpbios";
101 char *argv[3], **envp, *buf, *scratch; 102 char *argv[3], **envp, *buf, *scratch;
102 int i = 0, value; 103 int i = 0, value;
103 104
@@ -112,7 +113,7 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
112 * integrated into the driver core and use the usual infrastructure 113 * integrated into the driver core and use the usual infrastructure
113 * like sysfs and uevents 114 * like sysfs and uevents
114 */ 115 */
115 argv[0] = "/sbin/pnpbios"; 116 argv[0] = (char *)sbin_pnpbios;
116 argv[1] = "dock"; 117 argv[1] = "dock";
117 argv[2] = NULL; 118 argv[2] = NULL;
118 119
@@ -139,7 +140,7 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
139 info->location_id, info->serial, info->capabilities); 140 info->location_id, info->serial, info->capabilities);
140 envp[i] = NULL; 141 envp[i] = NULL;
141 142
142 value = call_usermodehelper(argv [0], argv, envp, UMH_WAIT_EXEC); 143 value = call_usermodehelper(sbin_pnpbios, argv, envp, UMH_WAIT_EXEC);
143 kfree(buf); 144 kfree(buf);
144 kfree(envp); 145 kfree(envp);
145 return 0; 146 return 0;
diff --git a/drivers/staging/greybus/svc_watchdog.c b/drivers/staging/greybus/svc_watchdog.c
index 3729460fb954..12cef5c06e27 100644
--- a/drivers/staging/greybus/svc_watchdog.c
+++ b/drivers/staging/greybus/svc_watchdog.c
@@ -44,14 +44,14 @@ static int svc_watchdog_pm_notifier(struct notifier_block *notifier,
44 44
45static void greybus_reset(struct work_struct *work) 45static void greybus_reset(struct work_struct *work)
46{ 46{
47 static char start_path[256] = "/system/bin/start"; 47 static char const start_path[] = "/system/bin/start";
48 static char *envp[] = { 48 static char *envp[] = {
49 "HOME=/", 49 "HOME=/",
50 "PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin", 50 "PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin",
51 NULL, 51 NULL,
52 }; 52 };
53 static char *argv[] = { 53 static char *argv[] = {
54 start_path, 54 (char *)start_path,
55 "unipro_reset", 55 "unipro_reset",
56 NULL, 56 NULL,
57 }; 57 };
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index 9bc284812c30..dbb58fb16482 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -268,8 +268,8 @@ void rtl92e_dm_watchdog(struct net_device *dev)
268static void _rtl92e_dm_check_ac_dc_power(struct net_device *dev) 268static void _rtl92e_dm_check_ac_dc_power(struct net_device *dev)
269{ 269{
270 struct r8192_priv *priv = rtllib_priv(dev); 270 struct r8192_priv *priv = rtllib_priv(dev);
271 static char *ac_dc_script = "/etc/acpi/wireless-rtl-ac-dc-power.sh"; 271 static char const ac_dc_script[] = "/etc/acpi/wireless-rtl-ac-dc-power.sh";
272 char *argv[] = {ac_dc_script, DRV_NAME, NULL}; 272 char *argv[] = {(char *)ac_dc_script, DRV_NAME, NULL};
273 static char *envp[] = {"HOME=/", 273 static char *envp[] = {"HOME=/",
274 "TERM=linux", 274 "TERM=linux",
275 "PATH=/usr/bin:/bin", 275 "PATH=/usr/bin:/bin",
@@ -1823,7 +1823,7 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data)
1823 enum rt_rf_power_state eRfPowerStateToSet; 1823 enum rt_rf_power_state eRfPowerStateToSet;
1824 bool bActuallySet = false; 1824 bool bActuallySet = false;
1825 char *argv[3]; 1825 char *argv[3];
1826 static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh"; 1826 static char const RadioPowerPath[] = "/etc/acpi/events/RadioPower.sh";
1827 static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", 1827 static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin",
1828 NULL}; 1828 NULL};
1829 1829
@@ -1862,7 +1862,7 @@ static void _rtl92e_dm_check_rf_ctrl_gpio(void *data)
1862 else 1862 else
1863 argv[1] = "RFON"; 1863 argv[1] = "RFON";
1864 1864
1865 argv[0] = RadioPowerPath; 1865 argv[0] = (char *)RadioPowerPath;
1866 argv[2] = NULL; 1866 argv[2] = NULL;
1867 call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); 1867 call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC);
1868 } 1868 }
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 596205d939a1..e06a4ae5f3ad 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -613,6 +613,7 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls)
613{ 613{
614 struct nfs4_client *clp = ls->ls_stid.sc_client; 614 struct nfs4_client *clp = ls->ls_stid.sc_client;
615 char addr_str[INET6_ADDRSTRLEN]; 615 char addr_str[INET6_ADDRSTRLEN];
616 static char const nfsd_recall_failed[] = "/sbin/nfsd-recall-failed";
616 static char *envp[] = { 617 static char *envp[] = {
617 "HOME=/", 618 "HOME=/",
618 "TERM=linux", 619 "TERM=linux",
@@ -628,12 +629,13 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls)
628 "nfsd: client %s failed to respond to layout recall. " 629 "nfsd: client %s failed to respond to layout recall. "
629 " Fencing..\n", addr_str); 630 " Fencing..\n", addr_str);
630 631
631 argv[0] = "/sbin/nfsd-recall-failed"; 632 argv[0] = (char *)nfsd_recall_failed;
632 argv[1] = addr_str; 633 argv[1] = addr_str;
633 argv[2] = ls->ls_file->f_path.mnt->mnt_sb->s_id; 634 argv[2] = ls->ls_file->f_path.mnt->mnt_sb->s_id;
634 argv[3] = NULL; 635 argv[3] = NULL;
635 636
636 error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); 637 error = call_usermodehelper(nfsd_recall_failed, argv, envp,
638 UMH_WAIT_PROC);
637 if (error) { 639 if (error) {
638 printk(KERN_ERR "nfsd: fence failed for client %s: %d!\n", 640 printk(KERN_ERR "nfsd: fence failed for client %s: %d!\n",
639 addr_str, error); 641 addr_str, error);
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 43affcf10b22..9822e500d50d 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -72,7 +72,7 @@ static void umh_keys_cleanup(struct subprocess_info *info)
72/* 72/*
73 * Call a usermode helper with a specific session keyring. 73 * Call a usermode helper with a specific session keyring.
74 */ 74 */
75static int call_usermodehelper_keys(char *path, char **argv, char **envp, 75static int call_usermodehelper_keys(const char *path, char **argv, char **envp,
76 struct key *session_keyring, int wait) 76 struct key *session_keyring, int wait)
77{ 77{
78 struct subprocess_info *info; 78 struct subprocess_info *info;
@@ -95,6 +95,7 @@ static int call_sbin_request_key(struct key_construction *cons,
95 const char *op, 95 const char *op,
96 void *aux) 96 void *aux)
97{ 97{
98 static char const request_key[] = "/sbin/request-key";
98 const struct cred *cred = current_cred(); 99 const struct cred *cred = current_cred();
99 key_serial_t prkey, sskey; 100 key_serial_t prkey, sskey;
100 struct key *key = cons->key, *authkey = cons->authkey, *keyring, 101 struct key *key = cons->key, *authkey = cons->authkey, *keyring,
@@ -161,7 +162,7 @@ static int call_sbin_request_key(struct key_construction *cons,
161 162
162 /* set up the argument list */ 163 /* set up the argument list */
163 i = 0; 164 i = 0;
164 argv[i++] = "/sbin/request-key"; 165 argv[i++] = (char *)request_key;
165 argv[i++] = (char *) op; 166 argv[i++] = (char *) op;
166 argv[i++] = key_str; 167 argv[i++] = key_str;
167 argv[i++] = uid_str; 168 argv[i++] = uid_str;
@@ -172,7 +173,7 @@ static int call_sbin_request_key(struct key_construction *cons,
172 argv[i] = NULL; 173 argv[i] = NULL;
173 174
174 /* do it */ 175 /* do it */
175 ret = call_usermodehelper_keys(argv[0], argv, envp, keyring, 176 ret = call_usermodehelper_keys(request_key, argv, envp, keyring,
176 UMH_WAIT_PROC); 177 UMH_WAIT_PROC);
177 kdebug("usermode -> 0x%x", ret); 178 kdebug("usermode -> 0x%x", ret);
178 if (ret >= 0) { 179 if (ret >= 0) {