From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
Jiri Kosina <jkosina@suse.cz>,
syzbot+3cbe5cd105d2ad56a1df@syzkaller.appspotmail.com
Subject: [PATCH 4.19 09/63] HID: logitech: Fix general protection fault caused by Logitech driver
Date: Sun, 29 Sep 2019 15:53:42 +0200 [thread overview]
Message-ID: <20190929135032.890160688@linuxfoundation.org> (raw)
In-Reply-To: <20190929135031.382429403@linuxfoundation.org>
From: Alan Stern <stern@rowland.harvard.edu>
commit 5f9242775bb61f390f0885f23fc16397262c7538 upstream.
The syzbot fuzzer found a general protection fault in the HID subsystem:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
CPU: 0 PID: 3715 Comm: syz-executor.3 Not tainted 5.2.0-rc6+ #15
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:__pm_runtime_resume+0x49/0x180 drivers/base/power/runtime.c:1069
Code: ed 74 d5 fe 45 85 ed 0f 85 9a 00 00 00 e8 6f 73 d5 fe 48 8d bd c1 02
00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48
89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 fe 00 00 00
RSP: 0018:ffff8881d99d78e0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000000000020 RCX: ffffc90003f3f000
RDX: 0000000416d8686d RSI: ffffffff82676841 RDI: 00000020b6c3436a
RBP: 00000020b6c340a9 R08: ffff8881c6d64800 R09: fffffbfff0e84c25
R10: ffff8881d99d7940 R11: ffffffff87426127 R12: 0000000000000004
R13: 0000000000000000 R14: ffff8881d9b94000 R15: ffffffff897f9048
FS: 00007f047f542700(0000) GS:ffff8881db200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b30f21000 CR3: 00000001ca032000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
pm_runtime_get_sync include/linux/pm_runtime.h:226 [inline]
usb_autopm_get_interface+0x1b/0x50 drivers/usb/core/driver.c:1707
usbhid_power+0x7c/0xe0 drivers/hid/usbhid/hid-core.c:1234
hid_hw_power include/linux/hid.h:1038 [inline]
hidraw_open+0x20d/0x740 drivers/hid/hidraw.c:282
chrdev_open+0x219/0x5c0 fs/char_dev.c:413
do_dentry_open+0x497/0x1040 fs/open.c:778
do_last fs/namei.c:3416 [inline]
path_openat+0x1430/0x3ff0 fs/namei.c:3533
do_filp_open+0x1a1/0x280 fs/namei.c:3563
do_sys_open+0x3c0/0x580 fs/open.c:1070
do_syscall_64+0xb7/0x560 arch/x86/entry/common.c:301
entry_SYSCALL_64_after_hwframe+0x49/0xbe
It turns out the fault was caused by a bug in the HID Logitech driver,
which violates the requirement that every pathway calling
hid_hw_start() must also call hid_hw_stop(). This patch fixes the bug
by making sure the requirement is met.
Reported-and-tested-by: syzbot+3cbe5cd105d2ad56a1df@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <stable@vger.kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hid/hid-lg.c | 10 ++++++----
drivers/hid/hid-lg4ff.c | 1 -
2 files changed, 6 insertions(+), 5 deletions(-)
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -763,7 +763,7 @@ static int lg_probe(struct hid_device *h
if (!buf) {
ret = -ENOMEM;
- goto err_free;
+ goto err_stop;
}
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
@@ -795,9 +795,12 @@ static int lg_probe(struct hid_device *h
ret = lg4ff_init(hdev);
if (ret)
- goto err_free;
+ goto err_stop;
return 0;
+
+err_stop:
+ hid_hw_stop(hdev);
err_free:
kfree(drv_data);
return ret;
@@ -808,8 +811,7 @@ static void lg_remove(struct hid_device
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
if (drv_data->quirks & LG_FF4)
lg4ff_deinit(hdev);
- else
- hid_hw_stop(hdev);
+ hid_hw_stop(hdev);
kfree(drv_data);
}
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -1483,7 +1483,6 @@ int lg4ff_deinit(struct hid_device *hid)
}
}
#endif
- hid_hw_stop(hid);
drv_data->device_props = NULL;
kfree(entry);
next prev parent reply other threads:[~2019-09-29 13:57 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-29 13:53 [PATCH 4.19 00/63] 4.19.76-stable review Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 01/63] Revert "Bluetooth: validate BLE connection interval updates" Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 02/63] net/ibmvnic: free reset work of removed device from queue Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 03/63] RDMA/restrack: Protect from reentry to resource return path Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 04/63] powerpc/xive: Fix bogus error code returned by OPAL Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 05/63] drm/amd/display: readd -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 06/63] IB/core: Add an unbound WQ type to the new CQ API Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 07/63] HID: prodikeys: Fix general protection fault during probe Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 08/63] HID: sony: Fix memory corruption issue on cleanup Greg Kroah-Hartman
2019-09-29 13:53 ` Greg Kroah-Hartman [this message]
2019-09-29 13:53 ` [PATCH 4.19 10/63] HID: hidraw: Fix invalid read in hidraw_ioctl Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 11/63] HID: Add quirk for HP X500 PIXART OEM mouse Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 12/63] mtd: cfi_cmdset_0002: Use chip_good() to retry in do_write_oneword() Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 13/63] crypto: talitos - fix missing break in switch statement Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 14/63] CIFS: fix deadlock in cached root handling Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 15/63] net/mlx5e: Set ECN for received packets using CQE indication Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 16/63] net/mlx5e: dont set CHECKSUM_COMPLETE on SCTP packets Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 17/63] mlx5: fix get_ip_proto() Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 18/63] net/mlx5e: Allow reporting of checksum unnecessary Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 19/63] net/mlx5e: XDP, Avoid checksum complete when XDP prog is loaded Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 20/63] net/mlx5e: Rx, Fixup skb checksum for packets with tail padding Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 21/63] net/mlx5e: Rx, Check ip headers sanity Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 22/63] iwlwifi: mvm: send BCAST management frames to the right station Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 23/63] iwlwifi: mvm: always init rs_fw with 20MHz bandwidth rates Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 24/63] media: tvp5150: fix switch exit in set control handler Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 25/63] ASoC: Intel: cht_bsw_max98090_ti: Enable codec clock once and keep it enabled Greg Kroah-Hartman
2019-09-29 13:53 ` [PATCH 4.19 26/63] ASoC: fsl: Fix of-node refcount unbalance in fsl_ssi_probe_from_dt() Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 27/63] ALSA: usb-audio: Add Hiby device family to quirks for native DSD support Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 28/63] ALSA: usb-audio: Add DSD support for EVGA NU Audio Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 29/63] ALSA: dice: fix wrong packet parameter for Alesis iO26 Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 30/63] ALSA: hda - Add laptop imic fixup for ASUS M9V laptop Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 31/63] ALSA: hda - Apply AMD controller workaround for Raven platform Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 32/63] objtool: Clobber user CFLAGS variable Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 33/63] tpm: Fix TPM 1.2 Shutdown sequence to prevent future TPM operations Greg Kroah-Hartman
2019-09-30 6:13 ` Pavel Machek
2019-09-30 12:57 ` Sasha Levin
2019-10-01 20:56 ` Jarkko Sakkinen
2019-09-29 13:54 ` [PATCH 4.19 34/63] pinctrl: sprd: Use define directive for sprd_pinconf_params values Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 35/63] power: supply: sysfs: ratelimit property read error message Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 36/63] locking/lockdep: Add debug_locks check in __lock_downgrade() Greg Kroah-Hartman
2019-09-29 14:43 ` Tetsuo Handa
2019-09-29 14:49 ` Greg Kroah-Hartman
2019-09-30 0:28 ` Sasha Levin
2019-09-30 1:46 ` Tetsuo Handa
2019-09-30 11:35 ` Sasha Levin
2019-09-30 14:00 ` Waiman Long
2019-10-01 22:20 ` Sasha Levin
2019-10-02 13:16 ` Waiman Long
2019-09-29 13:54 ` [PATCH 4.19 37/63] locking/lockdep: Add debug_locks check in __lock_downgrade() - again Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 38/63] scsi: qla2xxx: Turn off IOCB timeout timer on IOCB completion Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 39/63] scsi: qla2xxx: Remove all rports if fabric scan retry fails Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 40/63] scsi: qla2xxx: Return switch command on a timeout Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 41/63] Revert "drm/amd/powerplay: Enable/Disable NBPSTATE on On/OFF of UVD" Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 42/63] bpf: libbpf: retry loading program on EAGAIN Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 43/63] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 44/63] f2fs: check all the data segments against all node ones Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 45/63] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 46/63] bcache: remove redundant LIST_HEAD(journal) from run_cache_set() Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 47/63] initramfs: dont free a non-existent initrd Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 48/63] blk-mq: change gfp flags to GFP_NOIO in blk_mq_realloc_hw_ctxs Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 49/63] blk-mq: move cancel of requeue_work to the front of blk_exit_queue Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 50/63] Revert "f2fs: avoid out-of-range memory access" Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 51/63] dm zoned: fix invalid memory access Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 52/63] net/ibmvnic: Fix missing { in __ibmvnic_reset Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 53/63] f2fs: fix to do sanity check on segment bitmap of LFS curseg Greg Kroah-Hartman
2019-09-30 7:21 ` Pavel Machek
2019-09-30 7:36 ` Chao Yu
2019-09-30 13:22 ` Sasha Levin
2019-09-29 13:54 ` [PATCH 4.19 54/63] drm: Flush output polling on shutdown Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 55/63] net: dont warn in inet diag when IPV6 is disabled Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 56/63] Bluetooth: btrtl: HCI reset on close for Realtek BT chip Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 57/63] ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 58/63] drm/nouveau/disp/nv50-: fix center/aspect-corrected scaling Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 59/63] xfs: dont crash on null attr fork xfs_bmapi_read Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 60/63] netfilter: nft_socket: fix erroneous socket assignment Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 61/63] Bluetooth: btrtl: Additional Realtek 8822CE Bluetooth devices Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 62/63] net_sched: check cops->tcf_block in tc_bind_tclass() Greg Kroah-Hartman
2019-09-29 13:54 ` [PATCH 4.19 63/63] net/rds: An rds_sock is added too early to the hash table Greg Kroah-Hartman
2019-09-29 19:00 ` [PATCH 4.19 00/63] 4.19.76-stable review kernelci.org bot
2019-09-30 18:30 ` Guenter Roeck
2019-09-30 22:44 ` shuah
2019-10-01 1:05 ` Dan Rue
2019-10-01 14:58 ` Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190929135032.890160688@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=syzbot+3cbe5cd105d2ad56a1df@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).