diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/loop.c | 6 | ||||
-rw-r--r-- | drivers/char/tty_audit.c | 6 | ||||
-rw-r--r-- | drivers/connector/cn_proc.c | 16 | ||||
-rw-r--r-- | drivers/isdn/capi/capifs.c | 4 | ||||
-rw-r--r-- | drivers/isdn/hysdn/hysdn_procconf.c | 6 | ||||
-rw-r--r-- | drivers/net/tun.c | 8 | ||||
-rw-r--r-- | drivers/usb/core/devio.c | 10 | ||||
-rw-r--r-- | drivers/usb/core/inode.c | 4 |
8 files changed, 38 insertions, 22 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 5c4ee70d5cf3..fb06ed659212 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -936,8 +936,10 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) | |||
936 | { | 936 | { |
937 | int err; | 937 | int err; |
938 | struct loop_func_table *xfer; | 938 | struct loop_func_table *xfer; |
939 | uid_t uid = current_uid(); | ||
939 | 940 | ||
940 | if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid && | 941 | if (lo->lo_encrypt_key_size && |
942 | lo->lo_key_owner != uid && | ||
941 | !capable(CAP_SYS_ADMIN)) | 943 | !capable(CAP_SYS_ADMIN)) |
942 | return -EPERM; | 944 | return -EPERM; |
943 | if (lo->lo_state != Lo_bound) | 945 | if (lo->lo_state != Lo_bound) |
@@ -992,7 +994,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) | |||
992 | if (info->lo_encrypt_key_size) { | 994 | if (info->lo_encrypt_key_size) { |
993 | memcpy(lo->lo_encrypt_key, info->lo_encrypt_key, | 995 | memcpy(lo->lo_encrypt_key, info->lo_encrypt_key, |
994 | info->lo_encrypt_key_size); | 996 | info->lo_encrypt_key_size); |
995 | lo->lo_key_owner = current->uid; | 997 | lo->lo_key_owner = uid; |
996 | } | 998 | } |
997 | 999 | ||
998 | return 0; | 1000 | return 0; |
diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c index 5787249934c8..d961fa9612c4 100644 --- a/drivers/char/tty_audit.c +++ b/drivers/char/tty_audit.c | |||
@@ -86,10 +86,12 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid, | |||
86 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); | 86 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); |
87 | if (ab) { | 87 | if (ab) { |
88 | char name[sizeof(tsk->comm)]; | 88 | char name[sizeof(tsk->comm)]; |
89 | uid_t uid = task_uid(tsk); | ||
89 | 90 | ||
90 | audit_log_format(ab, "tty pid=%u uid=%u auid=%u ses=%u " | 91 | audit_log_format(ab, "tty pid=%u uid=%u auid=%u ses=%u " |
91 | "major=%d minor=%d comm=", tsk->pid, tsk->uid, | 92 | "major=%d minor=%d comm=", |
92 | loginuid, sessionid, buf->major, buf->minor); | 93 | tsk->pid, uid, loginuid, sessionid, |
94 | buf->major, buf->minor); | ||
93 | get_task_comm(name, tsk); | 95 | get_task_comm(name, tsk); |
94 | audit_log_untrustedstring(ab, name); | 96 | audit_log_untrustedstring(ab, name); |
95 | audit_log_format(ab, " data="); | 97 | audit_log_format(ab, " data="); |
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 5c9f67f98d10..c5afc98e2675 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -106,6 +106,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
106 | struct proc_event *ev; | 106 | struct proc_event *ev; |
107 | __u8 buffer[CN_PROC_MSG_SIZE]; | 107 | __u8 buffer[CN_PROC_MSG_SIZE]; |
108 | struct timespec ts; | 108 | struct timespec ts; |
109 | const struct cred *cred; | ||
109 | 110 | ||
110 | if (atomic_read(&proc_event_num_listeners) < 1) | 111 | if (atomic_read(&proc_event_num_listeners) < 1) |
111 | return; | 112 | return; |
@@ -115,14 +116,19 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
115 | ev->what = which_id; | 116 | ev->what = which_id; |
116 | ev->event_data.id.process_pid = task->pid; | 117 | ev->event_data.id.process_pid = task->pid; |
117 | ev->event_data.id.process_tgid = task->tgid; | 118 | ev->event_data.id.process_tgid = task->tgid; |
119 | rcu_read_lock(); | ||
120 | cred = __task_cred(task); | ||
118 | if (which_id == PROC_EVENT_UID) { | 121 | if (which_id == PROC_EVENT_UID) { |
119 | ev->event_data.id.r.ruid = task->uid; | 122 | ev->event_data.id.r.ruid = cred->uid; |
120 | ev->event_data.id.e.euid = task->euid; | 123 | ev->event_data.id.e.euid = cred->euid; |
121 | } else if (which_id == PROC_EVENT_GID) { | 124 | } else if (which_id == PROC_EVENT_GID) { |
122 | ev->event_data.id.r.rgid = task->gid; | 125 | ev->event_data.id.r.rgid = cred->gid; |
123 | ev->event_data.id.e.egid = task->egid; | 126 | ev->event_data.id.e.egid = cred->egid; |
124 | } else | 127 | } else { |
128 | rcu_read_unlock(); | ||
125 | return; | 129 | return; |
130 | } | ||
131 | rcu_read_unlock(); | ||
126 | get_seq(&msg->seq, &ev->cpu); | 132 | get_seq(&msg->seq, &ev->cpu); |
127 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 133 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
128 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 134 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index 550e80f390a6..0aa66ec4cbdd 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
@@ -156,8 +156,8 @@ void capifs_new_ncci(unsigned int number, dev_t device) | |||
156 | if (!inode) | 156 | if (!inode) |
157 | return; | 157 | return; |
158 | inode->i_ino = number+2; | 158 | inode->i_ino = number+2; |
159 | inode->i_uid = config.setuid ? config.uid : current->fsuid; | 159 | inode->i_uid = config.setuid ? config.uid : current_fsuid(); |
160 | inode->i_gid = config.setgid ? config.gid : current->fsgid; | 160 | inode->i_gid = config.setgid ? config.gid : current_fsgid(); |
161 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 161 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
162 | init_special_inode(inode, S_IFCHR|config.mode, device); | 162 | init_special_inode(inode, S_IFCHR|config.mode, device); |
163 | //inode->i_op = &capifs_file_inode_operations; | 163 | //inode->i_op = &capifs_file_inode_operations; |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 484299b031f8..8f9f4912de32 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -246,7 +246,8 @@ hysdn_conf_open(struct inode *ino, struct file *filep) | |||
246 | } | 246 | } |
247 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 247 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
248 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", | 248 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", |
249 | filep->f_uid, filep->f_gid, filep->f_mode); | 249 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
250 | filep->f_mode); | ||
250 | 251 | ||
251 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 252 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
252 | /* write only access -> write boot file or conf line */ | 253 | /* write only access -> write boot file or conf line */ |
@@ -331,7 +332,8 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
331 | } | 332 | } |
332 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 333 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
333 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", | 334 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", |
334 | filep->f_uid, filep->f_gid, filep->f_mode); | 335 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
336 | filep->f_mode); | ||
335 | 337 | ||
336 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 338 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
337 | /* write only access -> write boot file or conf line */ | 339 | /* write only access -> write boot file or conf line */ |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 33b6d1b122fb..55dc70c6b4db 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -702,6 +702,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
702 | struct tun_net *tn; | 702 | struct tun_net *tn; |
703 | struct tun_struct *tun; | 703 | struct tun_struct *tun; |
704 | struct net_device *dev; | 704 | struct net_device *dev; |
705 | const struct cred *cred = current_cred(); | ||
705 | int err; | 706 | int err; |
706 | 707 | ||
707 | tn = net_generic(net, tun_net_id); | 708 | tn = net_generic(net, tun_net_id); |
@@ -712,11 +713,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
712 | 713 | ||
713 | /* Check permissions */ | 714 | /* Check permissions */ |
714 | if (((tun->owner != -1 && | 715 | if (((tun->owner != -1 && |
715 | current->euid != tun->owner) || | 716 | cred->euid != tun->owner) || |
716 | (tun->group != -1 && | 717 | (tun->group != -1 && |
717 | current->egid != tun->group)) && | 718 | cred->egid != tun->group)) && |
718 | !capable(CAP_NET_ADMIN)) | 719 | !capable(CAP_NET_ADMIN)) { |
719 | return -EPERM; | 720 | return -EPERM; |
721 | } | ||
720 | } | 722 | } |
721 | else if (__dev_get_by_name(net, ifr->ifr_name)) | 723 | else if (__dev_get_by_name(net, ifr->ifr_name)) |
722 | return -EINVAL; | 724 | return -EINVAL; |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 2bccefebff1b..aa79280df15d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -574,6 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
574 | { | 574 | { |
575 | struct usb_device *dev = NULL; | 575 | struct usb_device *dev = NULL; |
576 | struct dev_state *ps; | 576 | struct dev_state *ps; |
577 | const struct cred *cred = current_cred(); | ||
577 | int ret; | 578 | int ret; |
578 | 579 | ||
579 | lock_kernel(); | 580 | lock_kernel(); |
@@ -617,8 +618,8 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
617 | init_waitqueue_head(&ps->wait); | 618 | init_waitqueue_head(&ps->wait); |
618 | ps->discsignr = 0; | 619 | ps->discsignr = 0; |
619 | ps->disc_pid = get_pid(task_pid(current)); | 620 | ps->disc_pid = get_pid(task_pid(current)); |
620 | ps->disc_uid = current->uid; | 621 | ps->disc_uid = cred->uid; |
621 | ps->disc_euid = current->euid; | 622 | ps->disc_euid = cred->euid; |
622 | ps->disccontext = NULL; | 623 | ps->disccontext = NULL; |
623 | ps->ifclaimed = 0; | 624 | ps->ifclaimed = 0; |
624 | security_task_getsecid(current, &ps->secid); | 625 | security_task_getsecid(current, &ps->secid); |
@@ -967,6 +968,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
967 | struct usb_host_endpoint *ep; | 968 | struct usb_host_endpoint *ep; |
968 | struct async *as; | 969 | struct async *as; |
969 | struct usb_ctrlrequest *dr = NULL; | 970 | struct usb_ctrlrequest *dr = NULL; |
971 | const struct cred *cred = current_cred(); | ||
970 | unsigned int u, totlen, isofrmlen; | 972 | unsigned int u, totlen, isofrmlen; |
971 | int ret, ifnum = -1; | 973 | int ret, ifnum = -1; |
972 | int is_in; | 974 | int is_in; |
@@ -1174,8 +1176,8 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1174 | as->signr = uurb->signr; | 1176 | as->signr = uurb->signr; |
1175 | as->ifnum = ifnum; | 1177 | as->ifnum = ifnum; |
1176 | as->pid = get_pid(task_pid(current)); | 1178 | as->pid = get_pid(task_pid(current)); |
1177 | as->uid = current->uid; | 1179 | as->uid = cred->uid; |
1178 | as->euid = current->euid; | 1180 | as->euid = cred->euid; |
1179 | security_task_getsecid(current, &as->secid); | 1181 | security_task_getsecid(current, &as->secid); |
1180 | if (!is_in) { | 1182 | if (!is_in) { |
1181 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1183 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 94632264dccf..185be760833e 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -277,8 +277,8 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de | |||
277 | 277 | ||
278 | if (inode) { | 278 | if (inode) { |
279 | inode->i_mode = mode; | 279 | inode->i_mode = mode; |
280 | inode->i_uid = current->fsuid; | 280 | inode->i_uid = current_fsuid(); |
281 | inode->i_gid = current->fsgid; | 281 | inode->i_gid = current_fsgid(); |
282 | inode->i_blocks = 0; | 282 | inode->i_blocks = 0; |
283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 283 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
284 | switch (mode & S_IFMT) { | 284 | switch (mode & S_IFMT) { |