diff options
author | Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> | 2015-05-18 19:11:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-31 23:38:21 +0200 |
commit | b575f7124ab33b2a4239613bcc870380308fe0a7 (patch) | |
tree | b8b35a0f055588f9e2f4361c601d8e01bc64c52d /drivers/hv | |
parent | mei: fix up uuid matching (diff) | |
download | linux-b575f7124ab33b2a4239613bcc870380308fe0a7.tar.xz linux-b575f7124ab33b2a4239613bcc870380308fe0a7.zip |
char: misc: restore MISC_DYNAMIC_MINOR on device_create() failure
On attempt to register a dynamic minor misc device its minor number is
updated to a virtual minor number prior to device_create() call,
however on error path misc->minor == MISC_DYNAMIC_MINOR is not
restored.
Following the rule of thumb that a function returning an error must
not change the state of the caller, assign MISC_DYNAMIC_MINOR back.
The problem is met in a sutuation, when subsys_initcall(misc_init) is
not yet called and misc_class is not created, but misc_register()
modifies statically defined ".minor = MISC_DYNAMIC_MINOR", therefore
implicitly changing the client's logic on next attempt (e.g. retrying
from deferred list) to register a misc device, whose minor number is
converted from dynamic to some unknown static one.
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
0 files changed, 0 insertions, 0 deletions