Skip to content
Snippets Groups Projects
Commit 0b509d8d authored by Tom Van Braeckel's avatar Tom Van Braeckel Committed by Greg Kroah-Hartman
Browse files

misc: pass miscdevice through file's private_data


Make the miscdevice accessible through the file's private_data.

Previously, this was done only when an open() file operation had been
registered. If no custom open() file operation was defined,
private_data was set to NULL.

This subtle quirk was confusing, to the point where kernel code
registered *empty* file open operations to have private_data point to
the misc device structure and avoid duplicating that logic.

And it could easily lead to bugs, where the addition or removal of a
custom open() file operation surprisingly changes the initial value of
a file's private_data structure.

To resolve this, we now place the miscdevice in the file's private_data
member unconditionally when open() is called.

Signed-off-by: default avatarTom Van Braeckel <tomvanbraeckel@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16c9c8e1
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment