The patch titled usb: fixup usb so it uses struct pid has been added to the -mm tree. Its filename is usb-fixup-usb-so-it-uses-struct-pid.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: usb: fixup usb so it uses struct pid From: ebiederm@xxxxxxxxxxxx (Eric W. Biederman) The problem with remembering a user space process by its pid is that it is possible that the process will exit, pid wrap around will occur. Converting to a struct pid avoid that problem, and paves the way for implementing a pid namespace. Also since usb is the only user of kill_proc_info_as_uid rename kill_proc_info_as_uid to kill_pid_info_as_uid and have the new version take a struct pid. Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx> Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/usb/core/devio.c | 10 ++++++---- drivers/usb/core/inode.c | 2 +- drivers/usb/core/usb.h | 2 +- include/linux/sched.h | 2 +- kernel/signal.c | 8 ++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff -puN drivers/usb/core/devio.c~usb-fixup-usb-so-it-uses-struct-pid drivers/usb/core/devio.c --- a/drivers/usb/core/devio.c~usb-fixup-usb-so-it-uses-struct-pid +++ a/drivers/usb/core/devio.c @@ -65,7 +65,7 @@ DEFINE_MUTEX(usbfs_mutex); struct async { struct list_head asynclist; struct dev_state *ps; - pid_t pid; + struct pid *pid; uid_t uid, euid; unsigned int signr; unsigned int ifnum; @@ -225,6 +225,7 @@ static struct async *alloc_async(unsigne static void free_async(struct async *as) { + put_pid(as->pid); kfree(as->urb->transfer_buffer); kfree(as->urb->setup_packet); usb_free_urb(as->urb); @@ -317,7 +318,7 @@ static void async_completed(struct urb * sinfo.si_errno = as->urb->status; sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = as->userurb; - kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, + kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid, as->euid, as->secid); } snoop(&urb->dev->dev, "urb complete\n"); @@ -572,7 +573,7 @@ static int usbdev_open(struct inode *ino INIT_LIST_HEAD(&ps->async_completed); init_waitqueue_head(&ps->wait); ps->discsignr = 0; - ps->disc_pid = current->pid; + ps->disc_pid = get_pid(task_pid(current)); ps->disc_uid = current->uid; ps->disc_euid = current->euid; ps->disccontext = NULL; @@ -610,6 +611,7 @@ static int usbdev_release(struct inode * usb_autosuspend_device(dev, 1); usb_unlock_device(dev); usb_put_dev(dev); + put_pid(ps->disc_pid); kfree(ps); return 0; } @@ -1062,7 +1064,7 @@ static int proc_do_submiturb(struct dev_ as->userbuffer = NULL; as->signr = uurb->signr; as->ifnum = ifnum; - as->pid = current->pid; + as->pid = get_pid(task_pid(current)); as->uid = current->uid; as->euid = current->euid; security_task_getsecid(current, &as->secid); diff -puN drivers/usb/core/inode.c~usb-fixup-usb-so-it-uses-struct-pid drivers/usb/core/inode.c --- a/drivers/usb/core/inode.c~usb-fixup-usb-so-it-uses-struct-pid +++ a/drivers/usb/core/inode.c @@ -699,7 +699,7 @@ static void usbfs_remove_device(struct u sinfo.si_errno = EPIPE; sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = ds->disccontext; - kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid, ds->secid); + kill_pid_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid, ds->secid); } } } diff -puN drivers/usb/core/usb.h~usb-fixup-usb-so-it-uses-struct-pid drivers/usb/core/usb.h --- a/drivers/usb/core/usb.h~usb-fixup-usb-so-it-uses-struct-pid +++ a/drivers/usb/core/usb.h @@ -122,7 +122,7 @@ struct dev_state { struct list_head async_completed; wait_queue_head_t wait; /* wake up if a request completed */ unsigned int discsignr; - pid_t disc_pid; + struct pid *disc_pid; uid_t disc_uid, disc_euid; void __user *disccontext; unsigned long ifclaimed; diff -puN include/linux/sched.h~usb-fixup-usb-so-it-uses-struct-pid include/linux/sched.h --- a/include/linux/sched.h~usb-fixup-usb-so-it-uses-struct-pid +++ a/include/linux/sched.h @@ -1269,12 +1269,12 @@ extern int force_sig_info(int, struct si extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); extern int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); +extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32); extern int kill_pgrp(struct pid *pid, int sig, int priv); extern int kill_pid(struct pid *pid, int sig, int priv); extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); extern int kill_pg_info(int, struct siginfo *, pid_t); extern int kill_proc_info(int, struct siginfo *, pid_t); -extern int kill_proc_info_as_uid(int, struct siginfo *, pid_t, uid_t, uid_t, u32); extern void do_notify_parent(struct task_struct *, int); extern void force_sig(int, struct task_struct *); extern void force_sig_specific(int, struct task_struct *); diff -puN kernel/signal.c~usb-fixup-usb-so-it-uses-struct-pid kernel/signal.c --- a/kernel/signal.c~usb-fixup-usb-so-it-uses-struct-pid +++ a/kernel/signal.c @@ -1136,8 +1136,8 @@ kill_proc_info(int sig, struct siginfo * return error; } -/* like kill_proc_info(), but doesn't use uid/euid of "current" */ -int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid, +/* like kill_pid_info(), but doesn't use uid/euid of "current" */ +int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid, uid_t uid, uid_t euid, u32 secid) { int ret = -EINVAL; @@ -1147,7 +1147,7 @@ int kill_proc_info_as_uid(int sig, struc return ret; read_lock(&tasklist_lock); - p = find_task_by_pid(pid); + p = pid_task(pid, PIDTYPE_PID); if (!p) { ret = -ESRCH; goto out_unlock; @@ -1171,7 +1171,7 @@ out_unlock: read_unlock(&tasklist_lock); return ret; } -EXPORT_SYMBOL_GPL(kill_proc_info_as_uid); +EXPORT_SYMBOL_GPL(kill_pid_info_as_uid); /* * kill_something_info() interprets pid in interesting ways just like kill(2). _ Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are megaraid-use-the-proper-type-to-hold-the-irq-number.patch x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch msi-use-kmem_cache_zalloc.patch sysctl-allow-proc-sys-without-sys_sysctl.patch sysctl-allow-proc-sys-without-sys_sysctl-fix.patch sysctl-document-that-sys_sysctl-will-be-removed.patch pid-implement-transfer_pid-and-use-it-to-simplify-de_thread.patch pid-remove-temporary-debug-code-in-attach_pid.patch de_thread-use-tsk-not-current.patch fix-conflict-with-the-is_init-identifier-on-parisc.patch pidspace-is_init.patch simplify-update_times-avoid-jiffies-jiffies_64-aliasing-problem-2.patch kexec-warning-fix.patch kill-extraneous-printk-in-kernel_restart.patch fix-mem_write-return-value.patch kcore-elf-note-namesz-field-fix.patch stack-overflow-safe-kdump-safe_smp_processor_id.patch stack-overflow-safe-kdump-safe_smp_processor_id_voyager.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id-fix.patch stack-overflow-safe-kdump-safe_smp_send_nmi_allbutself.patch proc-readdir-race-fix-take-3.patch proc-readdir-race-fix-take-3-race-fix.patch proc-reorder-the-functions-in-basec.patch proc-modify-proc_pident_lookup-to-be-completely-table-driven.patch proc-give-the-root-directory-a-task.patch pid-implement-access-helpers-for-a-tacks-various-process-groups.patch pid-add-do_each_pid_task.patch pid-implement-signal-functions-that-take-a-struct-pid.patch pid-export-the-symbols-needed-to-use-struct-pid.patch pid-implement-pid_nr.patch vt-update-spawnpid-to-be-a-struct-pid_t.patch vt-update-spawnpid-to-be-a-struct-pid_t-tidy.patch file-modify-struct-fown_struct-to-use-a-struct-pid.patch file-modify-struct-fown_struct-to-use-a-struct-pid-fix.patch pids-coding-style-use-struct-pidmap.patch proc-readdir-race-fix-take-3-fix-1.patch simplify-pid-iterators.patch move-pidmap-to-pspaceh.patch move-pidmap-to-pspaceh-fix.patch define-struct-pspace.patch proc-readdir-race-fix-take-3-fix-2.patch update-mq_notify-to-use-a-struct-pid.patch file-add-locking-to-f_getown.patch usb-fixup-usb-so-it-uses-struct-pid.patch proc-sysctl-add-_proc_do_string-helper.patch namespaces-add-nsproxy.patch namespaces-add-nsproxy-move-init_nsproxy-into-kernel-nsproxyc.patch namespaces-incorporate-fs-namespace-into-nsproxy.patch namespaces-incorporate-fs-namespace-into-nsproxy-whitespace.patch namespaces-utsname-introduce-temporary-helpers.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-sysctl-hack.patch namespaces-utsname-remove-system_utsname.patch namespaces-utsname-implement-clone_newuts-flag.patch uts-copy-nsproxy-only-when-needed.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit.patch namespaces-utsname-use-init_utsname-when-appropriate-klibc-bit.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit-2.patch ipc-namespace-core.patch ipc-namespace-utils.patch proc-make-the-generation-of-the-self-symlink-table-driven.patch proc-factor-out-an-instantiate-method-from-every-lookup-method.patch proc-remove-the-hard-coded-inode-numbers.patch proc-merge-proc_tid_attr-and-proc_tgid_attr.patch proc-use-pid_task-instead-of-open-coding-it.patch proc-convert-task_sig-to-use-lock_task_sighand.patch proc-convert-do_task_stat-to-use-lock_task_sighand.patch proc-drop-tasklist-lock-in-task_state.patch proc-properly-compute-tgid_offset.patch proc-remove-trailing-blank-entry-from-pid_entry-arrays.patch proc-remove-the-useless-smp-safe-comments-from-proc.patch proc-comment-what-proc_fill_cache-does.patch genirq-irq-convert-the-move_irq-flag-from-a-32bit-word-to-a-single-bit.patch genirq-irq-add-moved_masked_irq.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-msi-make-the-msi-boolean-tests-return-either-0-or-1.patch genirq-msi-implement-helper-functions-read_msi_msg-and-write_msi_msg.patch genirq-msi-refactor-the-msi_ops.patch genirq-msi-simplify-the-msi-irq-limit-policy.patch genirq-irq-add-a-dynamic-irq-creation-api.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-i386-irq-dynamic-irq-support.patch genirq-x86_64-irq-dynamic-irq-support.patch genirq-msi-make-the-msi-code-irq-based-and-not-vector-based.patch genirq-x86_64-irq-move-msi-message-composition-into-io_apicc.patch genirq-i386-irq-move-msi-message-composition-into-io_apicc.patch genirq-msi-only-build-msi-apicc-on-ia64.patch genirq-msi-only-build-msi-apicc-on-ia64-fix.patch genirq-x86_64-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-irq-remove-msi-hacks.patch genirq-irq-generalize-the-check-for-hardirq_bits.patch genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number.patch genirq-x86_64-irq-make-vector_irq-per-cpu.patch genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch genirq-x86_64-irq-kill-gsi_irq_sharing.patch genirq-x86_64-irq-kill-irq-compression.patch add-hypertransport-capability-defines.patch add-hypertransport-capability-defines-fix.patch initial-generic-hypertransport-interrupt-support.patch initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch pidhash-temporary-debug-checks.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html