[PATCH v2 2/2] staging: speakup: refactor to use existing code in vt

Samuel Thibault samuel.thibault at ens-lyon.org
Wed Apr 3 18:21:34 EDT 2019


Okash Khawaja, le mer. 03 avril 2019 23:07:42 +0100, a ecrit:
> Yes that's good point, thanks. There is also another, abeit unlikely,
> race where we put kref inside speakup_cancel_selection() before
> speakup_set_selection() has had a chance to get kref but after compxchg
> succeeded.

Indeed.

> I'm not sure of the best way to address that. One way would be to use a
> global bool to indicate whether put kref is needed. But that will need
> to be atomic with respect to tty_kref_get() in speakup_set_selection()
> and to tty_kref_put() in __speakup_set_selection(), which means
> addition of another lock.

It looks like just pushing the problem further.

But can't just just get the kref in set_selection before using cmpxchg?
and if that fails, put it back. If it succeeded, the work schedule will
happen, and either it will manage to take the tty and put its kref, or
be canceled, and the kref will be put as well.

Samuel


More information about the Speakup mailing list