mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
9ef5beb2ee
commit f11274396a538b31bc010f782e05c2ce3f804c13 upstream. uref->usage_index can be indirectly controlled by userspace, hence leading to a potential exploitation of the Spectre variant 1 vulnerability. This field is used as an array index by the hiddev_ioctl_usage() function, when 'cmd' is either HIDIOCGCOLLECTIONINDEX, HIDIOCGUSAGES or HIDIOCSUSAGES. For cmd == HIDIOCGCOLLECTIONINDEX case, uref->usage_index is compared to field->maxusage and then used as an index to dereference field->usage array. The same thing happens to the cmd == HIDIOC{G,S}USAGES cases, where uref->usage_index is checked against an array maximum value and then it is used as an index in an array. This is a summary of the HIDIOCGCOLLECTIONINDEX case, which matches the traditional Spectre V1 first load: copy_from_user(uref, user_arg, sizeof(*uref)) if (uref->usage_index >= field->maxusage) goto inval; i = field->usage[uref->usage_index].collection_index; return i; This patch fixes this by sanitizing field uref->usage_index before using it to index field->usage (HIDIOCGCOLLECTIONINDEX) or field->value in HIDIOC{G,S}USAGES arrays, thus, avoiding speculation in the first load. Signed-off-by: Breno Leitao <leitao@debian.org> -- v2: Contemplate cmd == HIDIOC{G,S}USAGES case Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> |
||
---|---|---|
.. | ||
i2c-hid | ||
usbhid | ||
hid-a4tech.c | ||
hid-apple.c | ||
hid-appleir.c | ||
hid-aureal.c | ||
hid-axff.c | ||
hid-belkin.c | ||
hid-cherry.c | ||
hid-chicony.c | ||
hid-core.c | ||
hid-cypress.c | ||
hid-debug.c | ||
hid-dr.c | ||
hid-elecom.c | ||
hid-emsff.c | ||
hid-ezkey.c | ||
hid-gaff.c | ||
hid-generic.c | ||
hid-gyration.c | ||
hid-holtek-kbd.c | ||
hid-holtekff.c | ||
hid-hyperv.c | ||
hid-icade.c | ||
hid-ids.h | ||
hid-input.c | ||
hid-kensington.c | ||
hid-keytouch.c | ||
hid-kye.c | ||
hid-lcpower.c | ||
hid-lenovo-tpkbd.c | ||
hid-lg.c | ||
hid-lg.h | ||
hid-lg2ff.c | ||
hid-lg3ff.c | ||
hid-lg4ff.c | ||
hid-lgff.c | ||
hid-logitech-dj.c | ||
hid-logitech-dj.h | ||
hid-magicmouse.c | ||
hid-microsoft.c | ||
hid-monterey.c | ||
hid-multitouch.c | ||
hid-ntrig.c | ||
hid-ortek.c | ||
hid-petalynx.c | ||
hid-picolcd.h | ||
hid-picolcd_backlight.c | ||
hid-picolcd_cir.c | ||
hid-picolcd_core.c | ||
hid-picolcd_debugfs.c | ||
hid-picolcd_fb.c | ||
hid-picolcd_lcd.c | ||
hid-picolcd_leds.c | ||
hid-pl.c | ||
hid-primax.c | ||
hid-prodikeys.c | ||
hid-ps3remote.c | ||
hid-roccat-arvo.c | ||
hid-roccat-arvo.h | ||
hid-roccat-common.c | ||
hid-roccat-common.h | ||
hid-roccat-isku.c | ||
hid-roccat-isku.h | ||
hid-roccat-kone.c | ||
hid-roccat-kone.h | ||
hid-roccat-koneplus.c | ||
hid-roccat-koneplus.h | ||
hid-roccat-konepure.c | ||
hid-roccat-konepure.h | ||
hid-roccat-kovaplus.c | ||
hid-roccat-kovaplus.h | ||
hid-roccat-lua.c | ||
hid-roccat-lua.h | ||
hid-roccat-pyra.c | ||
hid-roccat-pyra.h | ||
hid-roccat-savu.c | ||
hid-roccat-savu.h | ||
hid-roccat.c | ||
hid-saitek.c | ||
hid-samsung.c | ||
hid-sensor-hub.c | ||
hid-sjoy.c | ||
hid-sony.c | ||
hid-speedlink.c | ||
hid-steelseries.c | ||
hid-sunplus.c | ||
hid-synaptics-bt.c | ||
hid-thingm.c | ||
hid-tivo.c | ||
hid-tmff.c | ||
hid-topseed.c | ||
hid-twinhan.c | ||
hid-uclogic.c | ||
hid-wacom.c | ||
hid-waltop.c | ||
hid-wiimote-core.c | ||
hid-wiimote-debug.c | ||
hid-wiimote-ext.c | ||
hid-wiimote.h | ||
hid-zpff.c | ||
hid-zydacron.c | ||
hidraw.c | ||
Kconfig | ||
Makefile | ||
uhid.c |