diff options
| -rw-r--r-- | include/net/ax25.h | 4 | ||||
| -rw-r--r-- | init/Kconfig | 1 | ||||
| -rw-r--r-- | net/ax25/ax25_uid.c | 21 |
3 files changed, 16 insertions, 10 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h index 5d2352154cf6..53539acbd81a 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
| @@ -157,7 +157,7 @@ enum { | |||
| 157 | typedef struct ax25_uid_assoc { | 157 | typedef struct ax25_uid_assoc { |
| 158 | struct hlist_node uid_node; | 158 | struct hlist_node uid_node; |
| 159 | atomic_t refcount; | 159 | atomic_t refcount; |
| 160 | uid_t uid; | 160 | kuid_t uid; |
| 161 | ax25_address call; | 161 | ax25_address call; |
| 162 | } ax25_uid_assoc; | 162 | } ax25_uid_assoc; |
| 163 | 163 | ||
| @@ -434,7 +434,7 @@ extern unsigned long ax25_display_timer(struct timer_list *); | |||
| 434 | 434 | ||
| 435 | /* ax25_uid.c */ | 435 | /* ax25_uid.c */ |
| 436 | extern int ax25_uid_policy; | 436 | extern int ax25_uid_policy; |
| 437 | extern ax25_uid_assoc *ax25_findbyuid(uid_t); | 437 | extern ax25_uid_assoc *ax25_findbyuid(kuid_t); |
| 438 | extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); | 438 | extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); |
| 439 | extern const struct file_operations ax25_uid_fops; | 439 | extern const struct file_operations ax25_uid_fops; |
| 440 | extern void ax25_uid_free(void); | 440 | extern void ax25_uid_free(void); |
diff --git a/init/Kconfig b/init/Kconfig index 64ff9ce59443..8447e0ca4186 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -952,7 +952,6 @@ config UIDGID_CONVERTED | |||
| 952 | depends on NET_KEY = n | 952 | depends on NET_KEY = n |
| 953 | depends on INET_DIAG = n | 953 | depends on INET_DIAG = n |
| 954 | depends on DNS_RESOLVER = n | 954 | depends on DNS_RESOLVER = n |
| 955 | depends on AX25 = n | ||
| 956 | 955 | ||
| 957 | # Filesystems | 956 | # Filesystems |
| 958 | depends on USB_GADGETFS = n | 957 | depends on USB_GADGETFS = n |
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c index e3c579ba6325..957999e43ff7 100644 --- a/net/ax25/ax25_uid.c +++ b/net/ax25/ax25_uid.c | |||
| @@ -51,14 +51,14 @@ int ax25_uid_policy; | |||
| 51 | 51 | ||
| 52 | EXPORT_SYMBOL(ax25_uid_policy); | 52 | EXPORT_SYMBOL(ax25_uid_policy); |
| 53 | 53 | ||
| 54 | ax25_uid_assoc *ax25_findbyuid(uid_t uid) | 54 | ax25_uid_assoc *ax25_findbyuid(kuid_t uid) |
| 55 | { | 55 | { |
| 56 | ax25_uid_assoc *ax25_uid, *res = NULL; | 56 | ax25_uid_assoc *ax25_uid, *res = NULL; |
| 57 | struct hlist_node *node; | 57 | struct hlist_node *node; |
| 58 | 58 | ||
| 59 | read_lock(&ax25_uid_lock); | 59 | read_lock(&ax25_uid_lock); |
| 60 | ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { | 60 | ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { |
| 61 | if (ax25_uid->uid == uid) { | 61 | if (uid_eq(ax25_uid->uid, uid)) { |
| 62 | ax25_uid_hold(ax25_uid); | 62 | ax25_uid_hold(ax25_uid); |
| 63 | res = ax25_uid; | 63 | res = ax25_uid; |
| 64 | break; | 64 | break; |
| @@ -84,7 +84,7 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) | |||
| 84 | read_lock(&ax25_uid_lock); | 84 | read_lock(&ax25_uid_lock); |
| 85 | ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { | 85 | ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { |
| 86 | if (ax25cmp(&sax->sax25_call, &ax25_uid->call) == 0) { | 86 | if (ax25cmp(&sax->sax25_call, &ax25_uid->call) == 0) { |
| 87 | res = ax25_uid->uid; | 87 | res = from_kuid_munged(current_user_ns(), ax25_uid->uid); |
| 88 | break; | 88 | break; |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| @@ -93,9 +93,14 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) | |||
| 93 | return res; | 93 | return res; |
| 94 | 94 | ||
| 95 | case SIOCAX25ADDUID: | 95 | case SIOCAX25ADDUID: |
| 96 | { | ||
| 97 | kuid_t sax25_kuid; | ||
| 96 | if (!capable(CAP_NET_ADMIN)) | 98 | if (!capable(CAP_NET_ADMIN)) |
| 97 | return -EPERM; | 99 | return -EPERM; |
| 98 | user = ax25_findbyuid(sax->sax25_uid); | 100 | sax25_kuid = make_kuid(current_user_ns(), sax->sax25_uid); |
| 101 | if (!uid_valid(sax25_kuid)) | ||
| 102 | return -EINVAL; | ||
| 103 | user = ax25_findbyuid(sax25_kuid); | ||
| 99 | if (user) { | 104 | if (user) { |
| 100 | ax25_uid_put(user); | 105 | ax25_uid_put(user); |
| 101 | return -EEXIST; | 106 | return -EEXIST; |
| @@ -106,7 +111,7 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) | |||
| 106 | return -ENOMEM; | 111 | return -ENOMEM; |
| 107 | 112 | ||
| 108 | atomic_set(&ax25_uid->refcount, 1); | 113 | atomic_set(&ax25_uid->refcount, 1); |
| 109 | ax25_uid->uid = sax->sax25_uid; | 114 | ax25_uid->uid = sax25_kuid; |
| 110 | ax25_uid->call = sax->sax25_call; | 115 | ax25_uid->call = sax->sax25_call; |
| 111 | 116 | ||
| 112 | write_lock(&ax25_uid_lock); | 117 | write_lock(&ax25_uid_lock); |
| @@ -114,7 +119,7 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) | |||
| 114 | write_unlock(&ax25_uid_lock); | 119 | write_unlock(&ax25_uid_lock); |
| 115 | 120 | ||
| 116 | return 0; | 121 | return 0; |
| 117 | 122 | } | |
| 118 | case SIOCAX25DELUID: | 123 | case SIOCAX25DELUID: |
| 119 | if (!capable(CAP_NET_ADMIN)) | 124 | if (!capable(CAP_NET_ADMIN)) |
| 120 | return -EPERM; | 125 | return -EPERM; |
| @@ -172,7 +177,9 @@ static int ax25_uid_seq_show(struct seq_file *seq, void *v) | |||
| 172 | struct ax25_uid_assoc *pt; | 177 | struct ax25_uid_assoc *pt; |
| 173 | 178 | ||
| 174 | pt = hlist_entry(v, struct ax25_uid_assoc, uid_node); | 179 | pt = hlist_entry(v, struct ax25_uid_assoc, uid_node); |
| 175 | seq_printf(seq, "%6d %s\n", pt->uid, ax2asc(buf, &pt->call)); | 180 | seq_printf(seq, "%6d %s\n", |
| 181 | from_kuid_munged(seq_user_ns(seq), pt->uid), | ||
| 182 | ax2asc(buf, &pt->call)); | ||
| 176 | } | 183 | } |
| 177 | return 0; | 184 | return 0; |
| 178 | } | 185 | } |
