Skip to content

Commit cc7ed49

Browse files
author
Jiri Kosina
committed
HID: hidraw: enforce minors_lock locking via lockdep
lockdep is much more powerful enforcing the locking rules than code comments, so let's switch to it. Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent ecb4d52 commit cc7ed49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/hid/hidraw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
107107

108108
/*
109109
* The first byte of the report buffer is expected to be a report number.
110-
*
111-
* This function is to be called with the minors_lock mutex held.
112110
*/
113111
static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type)
114112
{
@@ -117,6 +115,8 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer,
117115
__u8 *buf;
118116
int ret = 0;
119117

118+
lockdep_assert_held(&minors_lock);
119+
120120
if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
121121
ret = -ENODEV;
122122
goto out;
@@ -181,8 +181,6 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
181181
* of buffer is the report number to request, or 0x0 if the defice does not
182182
* use numbered reports. The report_type parameter can be HID_FEATURE_REPORT
183183
* or HID_INPUT_REPORT.
184-
*
185-
* This function is to be called with the minors_lock mutex held.
186184
*/
187185
static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t count, unsigned char report_type)
188186
{
@@ -192,6 +190,8 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
192190
int ret = 0, len;
193191
unsigned char report_number;
194192

193+
lockdep_assert_held(&minors_lock);
194+
195195
if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
196196
ret = -ENODEV;
197197
goto out;

0 commit comments

Comments
 (0)