lkml.org 
[lkml]   [2020]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Input: Fix a ref counting issue
Date
In case of a managed resource, 'devm_input_device_release()' already has a
'input_put_device(dev)' call.

Avoid a double reference decrement by explicitly calling
'input_put_device()' only on non-managed input device.

Fixes: 2be975c6d920 ("Input: introduce managed input devices (add devres support)")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is completely speculative and compile tested only.
---
drivers/input/input.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 3cfd2c18eebd..c09c9f020667 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1920,7 +1920,8 @@ void input_free_device(struct input_dev *dev)
devm_input_device_release,
devm_input_device_match,
dev));
- input_put_device(dev);
+ else
+ input_put_device(dev);
}
}
EXPORT_SYMBOL(input_free_device);
--
2.27.0
\
 
 \ /
  Last update: 2020-11-29 09:48    [W:0.026 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site