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]

 



(Didn't receive the email in my mailbox so copying Samuel's reply from
speakup mail archives web page)

> Thinking again about it, you can not just put the kref on the tty, you
> need to know whether the work happened (thus already put the kref) or
> not (thus hasn't put the kref).

> So instead of just setting tty to NULL, you should xchg it with NULL,
> and if it wasn't NULL (the work didn't happen), put the kref.

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.

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. I wonder if there is a better solution.

Thanks,
Okash
_______________________________________________
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