From: Roderick Colenbrander Date: Wed, 4 Sep 2019 21:22:11 +0000 (-0700) Subject: HID: sony: Fix memory corruption issue on cleanup. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16694567a78161aa952cc41cfbc82fc7bf30c47c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git HID: sony: Fix memory corruption issue on cleanup. commit 2bcdacb70327013ca2066bfcf2af1009eff01f1d upstream. The sony driver is not properly cleaning up from potential failures in sony_input_configured. Currently it calls hid_hw_stop, while hid_connect is still running. This is not a good idea, instead hid_hw_stop should be moved to sony_probe. Similar changes were recently made to Logitech drivers, which were also doing improper cleanup. Signed-off-by: Roderick Colenbrander CC: stable@vger.kernel.org Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 51f7bcd799fa..6ce9b5e1a06f 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -2710,7 +2710,6 @@ err_stop: kfree(sc->output_report_dmabuf); sony_remove_dev_list(sc); sony_release_device_id(sc); - hid_hw_stop(hdev); return ret; } @@ -2772,6 +2771,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) */ if (!(hdev->claimed & HID_CLAIMED_INPUT)) { hid_err(hdev, "failed to claim input\n"); + hid_hw_stop(hdev); return -ENODEV; }