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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Speakup mailing list
Speakup@xxxxxxxxxxxxxxxxx
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup



[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux