Skip to content

Commit

Permalink
vt: selection, push console lock down
Browse files Browse the repository at this point in the history
commit 4b70dd57a15d2f4685ac6e38056bad93e81e982f upstream.

We need to nest the console lock in sel_lock, so we have to push it down
a bit. Fortunately, the callers of set_selection_* just lock the console
lock around the function call. So moving it down is easy.

In the next patch, we switch the order.

Signed-off-by: Jiri Slaby <[email protected]>
Fixes: 07e6124a1a46 ("vt: selection, close sel_buffer race")
Cc: stable <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

(cherry picked from commit ccd35863147dd447110b726a0d4911ab686aade9)
  • Loading branch information
Jiri Slaby authored and madisongh committed Jul 1, 2023
1 parent 7b2c652 commit 5d92b39
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/tty/vt/selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,9 @@ int set_selection(const struct tiocl_selection __user *v, struct tty_struct *tty
{
int ret;

mutex_lock(&sel_lock);
console_lock();
ret = __set_selection(v, tty);
console_unlock();
mutex_unlock(&sel_lock);

return ret;
}
Expand Down

0 comments on commit 5d92b39

Please sign in to comment.