Commit 1efa29cd authored by Eric W. Biederman's avatar Eric W. Biederman

userns: Make the airo wireless driver use kuids for proc uids and gids

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: John W. Linville <linville@tuxdriver.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 26711a79
...@@ -232,8 +232,10 @@ static int adhoc; ...@@ -232,8 +232,10 @@ static int adhoc;
static int probe = 1; static int probe = 1;
static kuid_t proc_kuid;
static int proc_uid /* = 0 */; static int proc_uid /* = 0 */;
static kgid_t proc_kgid;
static int proc_gid /* = 0 */; static int proc_gid /* = 0 */;
static int airo_perm = 0555; static int airo_perm = 0555;
...@@ -4499,78 +4501,79 @@ struct proc_data { ...@@ -4499,78 +4501,79 @@ struct proc_data {
static int setup_proc_entry( struct net_device *dev, static int setup_proc_entry( struct net_device *dev,
struct airo_info *apriv ) { struct airo_info *apriv ) {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
/* First setup the device directory */ /* First setup the device directory */
strcpy(apriv->proc_name,dev->name); strcpy(apriv->proc_name,dev->name);
apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
airo_entry); airo_entry);
if (!apriv->proc_entry) if (!apriv->proc_entry)
goto fail; goto fail;
apriv->proc_entry->uid = proc_uid; apriv->proc_entry->uid = proc_kuid;
apriv->proc_entry->gid = proc_gid; apriv->proc_entry->gid = proc_kgid;
/* Setup the StatsDelta */ /* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev); apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry) if (!entry)
goto fail_stats_delta; goto fail_stats_delta;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the Stats */ /* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm, entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev); apriv->proc_entry, &proc_stats_ops, dev);
if (!entry) if (!entry)
goto fail_stats; goto fail_stats;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the Status */ /* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm, entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev); apriv->proc_entry, &proc_status_ops, dev);
if (!entry) if (!entry)
goto fail_status; goto fail_status;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the Config */ /* Setup the Config */
entry = proc_create_data("Config", proc_perm, entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev); apriv->proc_entry, &proc_config_ops, dev);
if (!entry) if (!entry)
goto fail_config; goto fail_config;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the SSID */ /* Setup the SSID */
entry = proc_create_data("SSID", proc_perm, entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev); apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry) if (!entry)
goto fail_ssid; goto fail_ssid;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the APList */ /* Setup the APList */
entry = proc_create_data("APList", proc_perm, entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev); apriv->proc_entry, &proc_APList_ops, dev);
if (!entry) if (!entry)
goto fail_aplist; goto fail_aplist;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the BSSList */ /* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm, entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev); apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry) if (!entry)
goto fail_bsslist; goto fail_bsslist;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
/* Setup the WepKey */ /* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm, entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev); apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry) if (!entry)
goto fail_wepkey; goto fail_wepkey;
entry->uid = proc_uid; entry->uid = proc_kuid;
entry->gid = proc_gid; entry->gid = proc_kgid;
return 0; return 0;
...@@ -5697,11 +5700,16 @@ static int __init airo_init_module( void ) ...@@ -5697,11 +5700,16 @@ static int __init airo_init_module( void )
{ {
int i; int i;
proc_kuid = make_kuid(&init_user_ns, proc_uid);
proc_kgid = make_kgid(&init_user_ns, proc_gid);
if (!uid_valid(proc_kuid) || !gid_valid(proc_kgid))
return -EINVAL;
airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
if (airo_entry) { if (airo_entry) {
airo_entry->uid = proc_uid; airo_entry->uid = proc_kuid;
airo_entry->gid = proc_gid; airo_entry->gid = proc_kgid;
} }
for (i = 0; i < 4 && io[i] && irq[i]; i++) { for (i = 0; i < 4 && io[i] && irq[i]; i++) {
......
...@@ -1003,8 +1003,6 @@ config UIDGID_CONVERTED ...@@ -1003,8 +1003,6 @@ config UIDGID_CONVERTED
depends on !UML || HOSTFS = n depends on !UML || HOSTFS = n
# The rare drivers that won't build # The rare drivers that won't build
depends on AIRO = n
depends on AIRO_CS = n
depends on TUN = n depends on TUN = n
depends on INFINIBAND_QIB = n depends on INFINIBAND_QIB = n
depends on BLK_DEV_LOOP = n depends on BLK_DEV_LOOP = n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment