aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mousedev.c')
-rw-r--r--drivers/input/mousedev.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index cc36edbb912f..79146d6ed2ab 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -265,6 +265,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev,
265 unsigned int new_head; 265 unsigned int new_head;
266 int wake_readers = 0; 266 int wake_readers = 0;
267 267
268 rcu_read_lock();
268 list_for_each_entry_rcu(client, &mousedev->client_list, node) { 269 list_for_each_entry_rcu(client, &mousedev->client_list, node) {
269 270
270 /* Just acquire the lock, interrupts already disabled */ 271 /* Just acquire the lock, interrupts already disabled */
@@ -309,6 +310,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev,
309 wake_readers = 1; 310 wake_readers = 1;
310 } 311 }
311 } 312 }
313 rcu_read_unlock();
312 314
313 if (wake_readers) 315 if (wake_readers)
314 wake_up_interruptible(&mousedev->wait); 316 wake_up_interruptible(&mousedev->wait);
@@ -499,12 +501,7 @@ static void mousedev_attach_client(struct mousedev *mousedev,
499 spin_lock(&mousedev->client_lock); 501 spin_lock(&mousedev->client_lock);
500 list_add_tail_rcu(&client->node, &mousedev->client_list); 502 list_add_tail_rcu(&client->node, &mousedev->client_list);
501 spin_unlock(&mousedev->client_lock); 503 spin_unlock(&mousedev->client_lock);
502 /* 504 synchronize_rcu();
503 * We don't use synchronize_rcu() here because read-side
504 * critical section is protected by a spinlock (dev->event_lock)
505 * instead of rcu_read_lock().
506 */
507 synchronize_sched();
508} 505}
509 506
510static void mousedev_detach_client(struct mousedev *mousedev, 507static void mousedev_detach_client(struct mousedev *mousedev,
@@ -513,7 +510,7 @@ static void mousedev_detach_client(struct mousedev *mousedev,
513 spin_lock(&mousedev->client_lock); 510 spin_lock(&mousedev->client_lock);
514 list_del_rcu(&client->node); 511 list_del_rcu(&client->node);
515 spin_unlock(&mousedev->client_lock); 512 spin_unlock(&mousedev->client_lock);
516 synchronize_sched(); 513 synchronize_rcu();
517} 514}
518 515
519static int mousedev_release(struct inode *inode, struct file *file) 516static int mousedev_release(struct inode *inode, struct file *file)