RE: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip

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

 



Arnd, 

>An application can open the device, and then do a 
>pthread_create() or a fork(). In either case, you have two 
>concurrent threads that have access to the file pointer and 
>can read from it concurrently, which is inherently racy 
>regarding which of the processes gets the data.

In that case I would relay on the application to synchronise the access.

>This is not very different from opening the file descriptor in 
>multiple processes, which you prevent using your logic.

but in the case when two independent applications try to open my device I can't let the second to access. They obviously won't synch the access.

>You can of course argue that you try your best to prevent the 
>race. Traditionally, e.g. on serial ports and the like, we 
>don't do this but instead rely on user space synchronizing the 
>access. What you have to make sure of course is that multiple 
>threads calling read on the same file can never bring the 
>kernel driver into an invalid state.

I assume, if an application shares the file pointer deliberately it have to sync the access. In other cases, the driver needs to secure it.

Waldek--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux