Skip to content

Commit f4f9edc

Browse files
peterhurleygregkh
authored andcommitted
staging/speakup: Use tty_ldisc_ref() for paste kworker
As the function documentation for tty_ldisc_ref_wait() notes, it is only callable from a tty file_operations routine; otherwise there is no guarantee the ref won't be NULL. The key difference with the VT's paste_selection() is that is an ioctl, where __speakup_paste_selection() is completely async kworker, kicked off from interrupt context. Fixes: 28a821c ("Staging: speakup: Update __speakup_paste_selection() tty (ab)usage to match vt") Cc: <stable@vger.kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6d27a63 commit f4f9edc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/staging/speakup/selection.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ static void __speakup_paste_selection(struct work_struct *work)
142142
struct tty_ldisc *ld;
143143
DECLARE_WAITQUEUE(wait, current);
144144

145-
ld = tty_ldisc_ref_wait(tty);
145+
ld = tty_ldisc_ref(tty);
146+
if (!ld)
147+
goto tty_unref;
146148
tty_buffer_lock_exclusive(&vc->port);
147149

148150
add_wait_queue(&vc->paste_wait, &wait);
@@ -162,6 +164,7 @@ static void __speakup_paste_selection(struct work_struct *work)
162164

163165
tty_buffer_unlock_exclusive(&vc->port);
164166
tty_ldisc_deref(ld);
167+
tty_unref:
165168
tty_kref_put(tty);
166169
}
167170

0 commit comments

Comments
 (0)