Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 148969 Details for
Bug 177044
Mouse disconnect races with close of /dev/input/mice, causing crash
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Test patch 1
linux-2.6.9-42.26.EL-177044-1.diff (text/plain), 4.84 KB, created by
Pete Zaitcev
on 2007-02-28 22:32:51 UTC
(
hide
)
Description:
Test patch 1
Filename:
MIME Type:
Creator:
Pete Zaitcev
Created:
2007-02-28 22:32:51 UTC
Size:
4.84 KB
patch
obsolete
>diff -urp -X dontdiff linux-2.6.9-42.26.EL/drivers/input/mousedev.c linux-2.6.9-42.26.EL.z1/drivers/input/mousedev.c >--- linux-2.6.9-42.26.EL/drivers/input/mousedev.c 2006-11-28 17:53:38.000000000 -0800 >+++ linux-2.6.9-42.26.EL.z1/drivers/input/mousedev.c 2007-02-28 14:22:16.000000000 -0800 >@@ -28,6 +28,7 @@ > #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX > #include <linux/miscdevice.h> > #endif >+#include <asm/semaphore.h> > > MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); > MODULE_DESCRIPTION("Mouse (ExplorerPS/2) device interfaces"); >@@ -66,6 +67,7 @@ struct mousedev { > char name[16]; > wait_queue_head_t wait; > struct list_head list; >+ struct list_head h_node; > struct input_handle handle; > > struct mousedev_hw_data packet; >@@ -108,10 +110,13 @@ static unsigned char mousedev_imps_seq[] > static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 }; > > static struct input_handler mousedev_handler; >+static LIST_HEAD(mousedev_h_list); > > static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; > static struct mousedev mousedev_mix; > >+static DECLARE_MUTEX(mousedev_lock); >+ > #define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) > #define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) > >@@ -337,11 +342,9 @@ static void mousedev_free(struct mousede > > static void mixdev_release(void) > { >- struct input_handle *handle; >- >- list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { >- struct mousedev *mousedev = handle->private; >+ struct mousedev *mousedev; > >+ list_for_each_entry(mousedev, &mousedev_h_list, h_node) { > if (!mousedev->open) { > if (mousedev->exist) > input_close_device(&mousedev->handle); >@@ -357,6 +360,7 @@ static int mousedev_release(struct inode > > mousedev_fasync(-1, file, 0); > >+ down(&mousedev_lock); > list_del(&list->node); > > if (!--list->mousedev->open) { >@@ -373,6 +377,7 @@ static int mousedev_release(struct inode > mousedev_free(list->mousedev); > } > } >+ up(&mousedev_lock); > > kfree(list); > return 0; >@@ -381,7 +386,6 @@ static int mousedev_release(struct inode > static int mousedev_open(struct inode * inode, struct file * file) > { > struct mousedev_list *list; >- struct input_handle *handle; > struct mousedev *mousedev; > int i; > >@@ -392,11 +396,16 @@ static int mousedev_open(struct inode * > #endif > i = iminor(inode) - MOUSEDEV_MINOR_BASE; > >- if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) >+ down(&mousedev_lock); >+ if (i >= MOUSEDEV_MINORS || !mousedev_table[i]) { >+ up(&mousedev_lock); > return -ENODEV; >+ } > >- if (!(list = kmalloc(sizeof(struct mousedev_list), GFP_KERNEL))) >+ if (!(list = kmalloc(sizeof(struct mousedev_list), GFP_KERNEL))) { >+ up(&mousedev_lock); > return -ENOMEM; >+ } > memset(list, 0, sizeof(struct mousedev_list)); > > spin_lock_init(&list->packet_lock); >@@ -408,16 +417,16 @@ static int mousedev_open(struct inode * > > if (!list->mousedev->open++) { > if (list->mousedev->minor == MOUSEDEV_MIX) { >- list_for_each_entry(handle, &mousedev_handler.h_list, h_node) { >- mousedev = handle->private; >+ list_for_each_entry(mousedev, &mousedev_h_list, h_node) { > if (!mousedev->open && mousedev->exist) >- input_open_device(handle); >+ input_open_device(&mousedev->handle); > } > } else > if (!mousedev_mix.open && list->mousedev->exist) > input_open_device(&list->mousedev->handle); > } > >+ up(&mousedev_lock); > return 0; > } > >@@ -577,7 +586,6 @@ static ssize_t mousedev_read(struct file > return count; > } > >-/* No kernel lock - fine */ > static unsigned int mousedev_poll(struct file *file, poll_table *wait) > { > struct mousedev_list *list = file->private_data; >@@ -601,14 +609,19 @@ static struct input_handle *mousedev_con > struct mousedev *mousedev; > int minor = 0; > >+ down(&mousedev_lock); >+ > for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); > if (minor == MOUSEDEV_MINORS) { >+ up(&mousedev_lock); > printk(KERN_ERR "mousedev: no more free mousedev devices\n"); > return NULL; > } > >- if (!(mousedev = kmalloc(sizeof(struct mousedev), GFP_KERNEL))) >+ if (!(mousedev = kmalloc(sizeof(struct mousedev), GFP_KERNEL))) { >+ up(&mousedev_lock); > return NULL; >+ } > memset(mousedev, 0, sizeof(struct mousedev)); > > INIT_LIST_HEAD(&mousedev->list); >@@ -633,6 +646,9 @@ static struct input_handle *mousedev_con > MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), > dev->dev, "mouse%d", minor); > >+ list_add_tail(&mousedev->h_node, &mousedev_h_list); >+ >+ up(&mousedev_lock); > return &mousedev->handle; > } > >@@ -641,6 +657,9 @@ static void mousedev_disconnect(struct i > struct mousedev *mousedev = handle->private; > struct mousedev_list *list; > >+ down(&mousedev_lock); >+ list_del(&mousedev->h_node); >+ > mousedev->exist = 0; > > if (mousedev->open) { >@@ -653,6 +672,7 @@ static void mousedev_disconnect(struct i > input_close_device(handle); > mousedev_free(mousedev); > } >+ up(&mousedev_lock); > } > > static struct input_device_id mousedev_ids[] = {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 177044
: 148969