Skip to content

Commit

Permalink
HID: playstation: fix free of uninialized pointer for DS4 in Bluetooth.
Browse files Browse the repository at this point in the history
The 'buf' variable is only used in the USB (if-path) and not in the Bluetooth
else-path. Since it is not set to NULL. this results in freeing an uninitialized
pointer. Since the else code-path doesn't need buf, just return 0.

Fixes: 2d77474 ("HID: playstation: add DualShock4 bluetooth support.")
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20221213044935.1775499-2-roderick.colenbrander@sony.com
  • Loading branch information
Roderick Colenbrander authored and Benjamin Tissoires committed Dec 19, 2022
1 parent 67c90d1 commit 0ee2981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ config HID_PLAYSTATION
select CRC32
select POWER_SUPPLY
help
Provides support for Sony PS5 controllers including support for
Provides support for Sony PS4/PS5 controllers including support for
its special functionalities e.g. touchpad, lights and motion
sensors.

Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-playstation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ static int dualshock4_get_mac_address(struct dualshock4 *ds4)
if (ret != sizeof(ds4->base.mac_address))
return -EINVAL;

ret = 0;
return 0;
}

err_free:
Expand Down

0 comments on commit 0ee2981

Please sign in to comment.