Skip to content

Commit

Permalink
HID: fix non-atomic allocation in hid_input_report
Browse files Browse the repository at this point in the history
'interrupt' variable can't be used to safely determine whether
we are running in atomic context or not, as we might be called from
during control transfer completion through hid_ctrl() in atomic
context with interrupt == 0.

Reported-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Sep 15, 2009
1 parent 1824090 commit d1ff652
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
return -1;
}

buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE,
interrupt ? GFP_ATOMIC : GFP_KERNEL);
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);

if (!buf) {
report = hid_get_report(report_enum, data);
Expand Down

0 comments on commit d1ff652

Please sign in to comment.