[PATCHv6 01/10] media: add CEC notifier support

Hans Verkuil hverkuil at xs4all.nl
Sat Apr 1 09:22:03 UTC 2017


On 31/03/17 22:46, Russell King - ARM Linux wrote:
> On Fri, Mar 31, 2017 at 02:20:27PM +0200, Hans Verkuil wrote:
>> +struct cec_notifier *cec_notifier_get(struct device *dev)
>> +{
>> +	struct cec_notifier *n;
>> +
>> +	mutex_lock(&cec_notifiers_lock);
>> +	list_for_each_entry(n, &cec_notifiers, head) {
>> +		if (n->dev == dev) {
>> +			mutex_unlock(&cec_notifiers_lock);
>> +			kref_get(&n->kref);
> 
> Isn't this racy?  What stops one thread trying to get the notifier
> while another thread puts the notifier?
> 

Both get and put take the global cec_notifiers_lock mutex.

Regards,

	Hans


More information about the dri-devel mailing list