@@ -882,7 +882,7 @@ static const struct file_operations input_devices_fileops = {
static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos)
{
if (mutex_lock_interruptible(&input_mutex))
- return NULL;
+ return ERR_PTR(-EAGAIN);
seq->private = (void *)(unsigned long)*pos;
return seq_list_start(&input_handler_list, *pos);
@@ -896,6 +896,10 @@ static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos)
static void input_handlers_seq_stop(struct seq_file *seq, void *v)
{
+ /* seq_start could get interrupted by signal before acquiring mutex */
+ if (IS_ERR(v) && ERR_PTR(v) == -EAGAIN)
+ return;
+
mutex_unlock(&input_mutex);
}