mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
HID: core: check parameters when sending/receiving data from the device
It is better to check them soon enough before triggering any kernel panic. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
7e0bc880fc
commit
5318251744
2 changed files with 7 additions and 1 deletions
|
@ -989,6 +989,9 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
|
|||
unsigned char reportnum, __u8 *buf,
|
||||
size_t len, unsigned char rtype, int reqtype)
|
||||
{
|
||||
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
|
||||
return -EINVAL;
|
||||
|
||||
if (hdev->ll_driver->raw_request)
|
||||
return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
|
||||
rtype, reqtype);
|
||||
|
@ -1008,6 +1011,9 @@ static inline int hid_hw_raw_request(struct hid_device *hdev,
|
|||
static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
|
||||
size_t len)
|
||||
{
|
||||
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
|
||||
return -EINVAL;
|
||||
|
||||
if (hdev->ll_driver->output_report)
|
||||
return hdev->ll_driver->output_report(hdev, buf, len);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue