Liwei Song
52b9b51a5f
i2c: ismt: fix wrong device address when unmap the data buffer
commit 17e83549e1 upstream.
Fix the following kernel bug:
kernel BUG at drivers/iommu/intel-iommu.c:3260!
invalid opcode: 0000 [#5] PREEMPT SMP
Hardware name: Intel Corp. Harcuvar/Server, BIOS HAVLCRB0.X64.0013.D39.1608311820 08/31/2016
task: ffff880175389950 ti: ffff880176bec000 task.ti: ffff880176bec000
RIP: 0010:[<ffffffff8150a83b>] [<ffffffff8150a83b>] intel_unmap+0x25b/0x260
RSP: 0018:ffff880176bef5e8 EFLAGS: 00010296
RAX: 0000000000000024 RBX: ffff8800773c7c88 RCX: 000000000000ce04
RDX: 0000000080000000 RSI: 0000000000000000 RDI: 0000000000000009
RBP: ffff880176bef638 R08: 0000000000000010 R09: 0000000000000004
R10: ffff880175389c78 R11: 0000000000000a4f R12: ffff8800773c7868
R13: 00000000ffffac88 R14: ffff8800773c7818 R15: 0000000000000001
FS: 00007fef21258700(0000) GS:ffff88017b5c0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000066d6d8 CR3: 000000007118c000 CR4: 00000000003406e0
Stack:
00000000ffffac88 ffffffff8199867f ffff880176bef5f8 ffff880100000030
ffff880176bef668 ffff8800773c7c88 ffff880178288098 ffff8800772c0010
ffff8800773c7818 0000000000000001 ffff880176bef648 ffffffff8150a86e
Call Trace:
[<ffffffff8199867f>] ? printk+0x46/0x48
[<ffffffff8150a86e>] intel_unmap_page+0xe/0x10
[<ffffffffa039d99b>] ismt_access+0x27b/0x8fa [i2c_ismt]
[<ffffffff81554420>] ? __pm_runtime_suspend+0xa0/0xa0
[<ffffffff815544a0>] ? pm_suspend_timer_fn+0x80/0x80
[<ffffffff81554420>] ? __pm_runtime_suspend+0xa0/0xa0
[<ffffffff815544a0>] ? pm_suspend_timer_fn+0x80/0x80
[<ffffffff8143dfd0>] ? pci_bus_read_dev_vendor_id+0xf0/0xf0
[<ffffffff8172b36c>] i2c_smbus_xfer+0xec/0x4b0
[<ffffffff810aa4d5>] ? vprintk_emit+0x345/0x530
[<ffffffffa038936b>] i2cdev_ioctl_smbus+0x12b/0x240 [i2c_dev]
[<ffffffff810aa829>] ? vprintk_default+0x29/0x40
[<ffffffffa0389b33>] i2cdev_ioctl+0x63/0x1ec [i2c_dev]
[<ffffffff811b04c8>] do_vfs_ioctl+0x328/0x5d0
[<ffffffff8119d8ec>] ? vfs_write+0x11c/0x190
[<ffffffff8109d449>] ? rt_up_read+0x19/0x20
[<ffffffff811b07f1>] SyS_ioctl+0x81/0xa0
[<ffffffff819a351b>] system_call_fastpath+0x16/0x6e
This happen When run "i2cdetect -y 0" detect SMBus iSMT adapter.
After finished I2C block read/write, when unmap the data buffer,
a wrong device address was pass to dma_unmap_single().
To fix this, give dma_unmap_single() the "dev" parameter, just like
what dma_map_single() does, then unmap can find the right devices.
Fixes: 13f35ac14c ("i2c: Adding support for Intel iSMT SMBus 2.0 host controller")
Signed-off-by: Liwei Song <liwei.song@windriver.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-17 20:59:29 +02:00
..
2018-08-15 18:14:42 +02:00
2018-05-01 15:13:08 -07:00
2018-02-28 10:18:33 +01:00
2018-08-03 07:55:22 +02:00
2018-07-22 14:27:36 +02:00
2018-02-13 12:35:55 +01:00
2018-08-15 18:14:45 +02:00
2017-03-12 06:41:52 +01:00
2018-07-17 11:37:54 +02:00
2018-08-03 07:55:16 +02:00
2018-08-03 07:55:19 +02:00
2018-05-30 07:50:47 +02:00
2018-08-15 18:14:41 +02:00
2018-07-03 11:23:13 +02:00
2018-05-30 07:50:32 +02:00
2018-06-26 08:08:08 +08:00
2018-07-03 11:23:08 +02:00
2018-08-06 16:23:04 +02:00
2018-02-28 10:18:33 +01:00
2018-04-13 19:48:09 +02:00
2018-05-30 07:50:48 +02:00
2018-06-06 16:44:33 +02:00
2018-08-03 07:55:21 +02:00
2017-11-21 09:23:21 +01:00
2018-05-30 07:50:18 +02:00
2018-05-30 07:50:24 +02:00
2018-06-16 09:52:33 +02:00
2018-08-06 16:23:04 +02:00
2018-08-03 07:55:21 +02:00
2018-03-24 11:00:12 +01:00
2018-04-20 08:20:41 +02:00
2018-05-30 07:50:46 +02:00
2018-06-06 16:44:38 +02:00
2018-08-17 20:59:29 +02:00
2018-05-30 07:50:47 +02:00
2018-02-25 11:05:55 +01:00
2018-07-03 11:23:11 +02:00
2018-08-15 18:14:43 +02:00
2018-08-03 07:55:11 +02:00
2018-05-30 07:50:20 +02:00
2016-10-27 18:43:43 -07:00
2018-06-06 16:44:35 +02:00
2018-06-13 16:16:42 +02:00
2018-04-13 19:48:03 +02:00
2016-10-07 14:42:05 -07:00
2018-05-30 07:50:42 +02:00
2017-08-06 18:59:42 -07:00
2017-09-09 17:39:41 +02:00
2018-08-03 07:55:20 +02:00
2018-08-03 07:55:26 +02:00
2018-08-03 07:55:24 +02:00
2016-10-17 15:43:05 +02:00
2018-05-25 16:13:06 +02:00
2018-08-03 07:55:16 +02:00
2018-07-17 11:37:51 +02:00
2018-08-03 07:55:24 +02:00
2018-08-15 18:14:43 +02:00
2018-08-15 18:14:42 +02:00
2018-03-22 09:17:46 +01:00
2018-05-30 07:50:22 +02:00
2018-07-03 11:23:13 +02:00
2018-07-17 11:37:54 +02:00
2018-08-03 07:55:22 +02:00
2018-07-03 11:23:08 +02:00
2016-10-10 20:16:43 -07:00
2018-05-30 07:50:43 +02:00
2018-04-08 12:12:57 +02:00
2018-08-15 18:14:52 +02:00
2016-11-11 08:45:08 -08:00
2018-03-22 09:17:51 +01:00
2018-01-23 19:57:07 +01:00
2018-08-06 16:23:02 +02:00
2018-06-26 08:08:05 +08:00
2018-04-29 11:31:56 +02:00
2018-04-13 19:47:56 +02:00
2016-10-11 15:06:32 -07:00
2016-09-20 20:57:12 +10:00
2018-07-25 11:24:01 +02:00
2018-07-03 11:23:16 +02:00
2017-12-14 09:28:22 +01:00
2018-08-03 07:55:20 +02:00
2017-03-12 06:41:50 +01:00
2017-10-08 10:26:03 +02:00
2018-07-03 11:23:13 +02:00
2018-08-03 07:55:13 +02:00
2018-07-03 11:23:12 +02:00
2018-08-15 18:14:42 +02:00
2018-05-30 07:50:47 +02:00
2018-05-30 07:50:45 +02:00
2017-07-27 15:08:08 -07:00
2017-01-09 08:32:16 +01:00
2018-08-03 07:55:25 +02:00
2018-03-24 11:00:20 +01:00
2018-08-03 07:55:23 +02:00
2018-04-24 09:34:12 +02:00
2018-08-03 07:55:22 +02:00
2018-04-13 19:47:59 +02:00
2018-08-03 07:55:25 +02:00
2017-10-12 11:51:19 +02:00
2018-08-03 07:55:13 +02:00
2018-07-22 14:27:38 +02:00
2018-07-03 11:23:16 +02:00
2016-10-19 08:11:43 -07:00
2018-08-06 16:23:04 +02:00
2017-03-12 06:41:50 +01:00
2018-07-03 11:23:06 +02:00
2018-05-30 07:50:34 +02:00
2018-07-03 11:23:16 +02:00
2018-05-30 07:50:44 +02:00
2018-02-25 11:05:45 +01:00