aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Praznik <frank.praznik@oh.rr.com>2015-05-05 20:47:28 -0400
committerJiri Kosina <jkosina@suse.cz>2015-05-07 04:41:34 -0400
commit131a8a9a56f16d8d237b39a8677ccee44a355392 (patch)
tree999270eca3d62fc6abd3e81100c0e7347e17d76e
parent8de29a35dc840a05e451ad035bcb06e21ccf605f (diff)
HID: sony: Prevent the freeing of an unitialized ida value
sony_allocate_output_report() was being called before sony_set_device_id() which meant that an unallocated ida value was was freed if the output report allocation failed and the probe function jumped to err_stop. Do the device ID allocation before the output report allocation to avoid freeing an unallocated value in case of a failure. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-sony.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 6ca96cebb44c..4c521b2c6a82 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1993,15 +1993,15 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
1993 return ret; 1993 return ret;
1994 } 1994 }
1995 1995
1996 ret = sony_allocate_output_report(sc); 1996 ret = sony_set_device_id(sc);
1997 if (ret < 0) { 1997 if (ret < 0) {
1998 hid_err(hdev, "failed to allocate the output report buffer\n"); 1998 hid_err(hdev, "failed to allocate the device id\n");
1999 goto err_stop; 1999 goto err_stop;
2000 } 2000 }
2001 2001
2002 ret = sony_set_device_id(sc); 2002 ret = sony_allocate_output_report(sc);
2003 if (ret < 0) { 2003 if (ret < 0) {
2004 hid_err(hdev, "failed to allocate the device id\n"); 2004 hid_err(hdev, "failed to allocate the output report buffer\n");
2005 goto err_stop; 2005 goto err_stop;
2006 } 2006 }
2007 2007