Tejun Heo
1a112d10f0
libata: introduce ata_host->n_tags to avoid oops on SAS controllers
1871ee134b ("libata: support the ata host which implements a queue
depth less than 32") directly used ata_port->scsi_host->can_queue from
ata_qc_new() to determine the number of tags supported by the host;
unfortunately, SAS controllers doing SATA don't initialize ->scsi_host
leading to the following oops.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
IP: [<ffffffff814e0618>] ata_qc_new_init+0x188/0x1b0
PGD 0
Oops: 0002 [#1] SMP
Modules linked in: isci libsas scsi_transport_sas mgag200 drm_kms_helper ttm
CPU: 1 PID: 518 Comm: udevd Not tainted 3.16.0-rc6+ #62
Hardware name: Intel Corporation S2600CO/S2600CO, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
task: ffff880c1a00b280 ti: ffff88061a000000 task.ti: ffff88061a000000
RIP: 0010:[<ffffffff814e0618>] [<ffffffff814e0618>] ata_qc_new_init+0x188/0x1b0
RSP: 0018:ffff88061a003ae8 EFLAGS: 00010012
RAX: 0000000000000001 RBX: ffff88000241ca80 RCX: 00000000000000fa
RDX: 0000000000000020 RSI: 0000000000000020 RDI: ffff8806194aa298
RBP: ffff88061a003ae8 R08: ffff8806194a8000 R09: 0000000000000000
R10: 0000000000000000 R11: ffff88000241ca80 R12: ffff88061ad58200
R13: ffff8806194aa298 R14: ffffffff814e67a0 R15: ffff8806194a8000
FS: 00007f3ad7fe3840(0000) GS:ffff880627620000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000058 CR3: 000000061a118000 CR4: 00000000001407e0
Stack:
ffff88061a003b20 ffffffff814e96e1 ffff88000241ca80 ffff88061ad58200
ffff8800b6bf6000 ffff880c1c988000 ffff880619903850 ffff88061a003b68
ffffffffa0056ce1 ffff88061a003b48 0000000013d6e6f8 ffff88000241ca80
Call Trace:
[<ffffffff814e96e1>] ata_sas_queuecmd+0xa1/0x430
[<ffffffffa0056ce1>] sas_queuecommand+0x191/0x220 [libsas]
[<ffffffff8149afee>] scsi_dispatch_cmd+0x10e/0x300
[<ffffffff814a3bc5>] scsi_request_fn+0x2f5/0x550
[<ffffffff81317613>] __blk_run_queue+0x33/0x40
[<ffffffff8131781a>] queue_unplugged+0x2a/0x90
[<ffffffff8131ceb4>] blk_flush_plug_list+0x1b4/0x210
[<ffffffff8131d274>] blk_finish_plug+0x14/0x50
[<ffffffff8117eaa8>] __do_page_cache_readahead+0x198/0x1f0
[<ffffffff8117ee21>] force_page_cache_readahead+0x31/0x50
[<ffffffff8117ee7e>] page_cache_sync_readahead+0x3e/0x50
[<ffffffff81172ac6>] generic_file_read_iter+0x496/0x5a0
[<ffffffff81219897>] blkdev_read_iter+0x37/0x40
[<ffffffff811e307e>] new_sync_read+0x7e/0xb0
[<ffffffff811e3734>] vfs_read+0x94/0x170
[<ffffffff811e43c6>] SyS_read+0x46/0xb0
[<ffffffff811e33d1>] ? SyS_lseek+0x91/0xb0
[<ffffffff8171ee29>] system_call_fastpath+0x16/0x1b
Code: 00 00 00 88 50 29 83 7f 08 01 19 d2 83 e2 f0 83 ea 50 88 50 34 c6 81 1d 02 00 00 40 c6 81 17 02 00 00 00 5d c3 66 0f 1f 44 00 00 <89> 14 25 58 00 00 00
Fix it by introducing ata_host->n_tags which is initialized to
ATA_MAX_QUEUE - 1 in ata_host_init() for SAS controllers and set to
scsi_host_template->can_queue in ata_host_register() for !SAS ones.
As SAS hosts are never registered, this will give them the same
ATA_MAX_QUEUE - 1 as before. Note that we can't use
scsi_host->can_queue directly for SAS hosts anyway as they can go
higher than the libata maximum.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Reported-by: Jesse Brandeburg <jesse.brandeburg@gmail.com>
Reported-by: Peter Hurley <peter@hurleysoftware.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Fixes: 1871ee134b ("libata: support the ata host which implements a queue depth less than 32")
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: stable@vger.kernel.org
2014-07-23 10:30:34 -04:00
..
2014-06-10 10:28:45 -07:00
2014-01-30 17:20:32 -08:00
2014-05-19 09:38:24 +02:00
2014-06-12 23:06:23 -07:00
2014-06-10 16:53:25 -07:00
2014-04-04 21:07:28 -07:00
2014-04-03 16:21:12 -07:00
2014-03-19 14:41:58 +09:00
2014-05-16 17:52:36 +02:00
2014-05-16 00:55:30 +02:00
2014-06-12 12:42:32 -07:00
2014-05-03 11:35:23 +01:00
2014-05-29 00:05:59 -07:00
2014-05-19 00:35:23 +00:00
2014-06-04 23:13:41 -07:00
2014-05-06 17:54:53 -04:00
2014-06-10 15:34:47 -07:00
2014-06-12 14:27:40 -07:00
2014-05-27 11:53:06 -07:00
2014-05-22 08:33:30 -04:00
2014-06-11 08:35:34 -07:00
2014-04-29 18:25:14 +02:00
2014-04-24 12:53:38 -07:00
2014-01-16 14:25:37 +01:00
2014-06-14 14:43:23 -07:00
2013-12-23 18:34:58 -08:00
2014-06-02 17:08:12 +01:00
2014-06-04 16:54:05 -07:00
2014-06-12 14:27:40 -07:00
2014-05-19 16:42:15 -04:00
2014-06-10 15:02:42 -07:00
2014-06-12 14:27:40 -07:00
2014-02-11 23:30:50 +05:30
2014-06-03 23:12:20 +02:00
2014-05-14 13:07:10 -04:00
2014-05-07 16:08:08 -04:00
2014-02-12 17:21:22 +00:00
2014-04-18 11:40:30 +02:00
2014-04-10 17:51:29 -04:00
2013-12-24 09:35:17 -08:00
2014-04-03 16:20:49 -07:00
2014-05-27 01:29:01 +02:00
2014-02-06 10:33:47 +01:00
2014-04-07 16:36:05 -07:00
2014-04-22 15:09:05 -06:00
2014-04-18 11:40:30 +02:00
2014-06-12 10:30:18 -07:00
2014-03-13 09:38:42 -06:00
2014-06-06 08:04:46 -06:00
2014-06-06 07:57:37 -06:00
2014-06-04 16:54:04 -07:00
2014-01-13 17:32:27 +01:00
2014-02-14 00:27:58 -05:00
2014-06-04 16:54:02 -07:00
2014-01-23 16:36:56 -08:00
2014-06-10 13:57:22 -07:00
2014-02-09 09:59:23 +08:00
2014-05-19 16:37:06 -04:00
2014-06-09 14:56:07 -07:00
2013-12-31 11:35:12 -08:00
2014-06-07 20:27:30 -07:00
2014-02-24 17:13:55 -08:00
2014-02-09 15:11:47 +01:00
2014-05-20 14:25:24 -05:00
2014-01-21 20:18:26 -08:00
2014-06-04 16:54:06 -07:00
2014-04-02 12:51:41 -07:00
2014-04-09 13:44:35 -07:00
2014-02-13 12:34:05 +01:00
2014-04-15 09:15:39 -07:00
2014-06-12 19:18:49 -07:00
2014-01-10 16:27:36 -08:00
2014-05-27 13:56:21 -07:00
2014-05-28 13:37:21 -07:00
2013-12-29 15:25:48 +01:00
2014-06-06 16:08:18 -07:00
2014-02-18 12:38:37 -08:00
2014-06-05 23:32:29 +02:00
2014-06-09 18:10:34 -07:00
2014-06-12 14:27:40 -07:00
2014-06-04 16:54:08 -07:00
2014-03-13 15:56:44 +01:00
2014-04-07 16:36:06 -07:00
2014-05-16 14:26:52 -04:00
2014-04-03 16:21:05 -07:00
2014-05-01 10:30:00 -04:00
2014-05-08 14:28:07 +08:00
2014-05-24 22:33:41 +09:00
2014-06-04 09:46:34 -04:00
2014-06-05 15:57:04 -07:00
2014-01-09 12:43:40 +01:00
2014-02-13 10:08:52 +05:30
2014-06-04 16:53:57 -07:00
2014-01-21 16:19:41 -08:00
2014-06-05 15:57:04 -07:00
2014-06-10 10:28:45 -07:00
2014-03-24 14:05:08 +00:00
2014-02-17 16:46:48 +01:00
2014-04-30 13:46:56 -06:00
2014-02-17 14:16:54 +05:30
2014-04-30 19:49:57 +01:00
2014-06-10 13:13:11 -06:00
2014-04-03 16:21:06 -07:00
2014-01-15 15:39:33 -08:00
2014-06-03 02:42:44 +01:00
2014-01-16 10:23:02 +10:30
2014-04-29 09:45:56 +09:00
2014-06-04 13:34:30 +09:00
2014-05-02 15:57:42 +03:00
2014-04-01 23:19:14 -04:00
2014-03-10 11:44:42 -04:00
2014-06-11 00:13:16 -07:00
2014-05-26 14:33:10 +02:00
2014-01-21 23:17:20 -08:00
2014-02-28 15:12:09 -08:00
2014-06-12 10:30:18 -07:00
2014-02-18 12:20:45 -08:00
2014-04-03 16:20:51 -07:00
2014-05-15 11:29:37 -04:00
2014-06-09 16:39:15 -07:00
2014-03-03 11:32:08 +01:00
2014-01-23 16:36:52 -08:00
2014-04-18 14:20:48 +02:00
2014-06-04 16:54:10 -07:00
2014-05-20 10:30:40 +09:00
2014-05-14 16:39:49 -07:00
2014-02-20 14:54:28 +01:00
2014-02-19 17:22:44 +01:00
2014-03-13 12:48:32 +01:00
2014-05-05 10:59:49 +01:00
2014-04-29 22:11:53 +01:00
2014-06-04 13:09:43 +02:00
2014-04-04 09:12:49 +02:00
2014-03-20 12:35:45 +01:00
2014-03-04 07:55:47 -08:00
2014-02-08 10:36:58 -05:00
2014-06-04 16:54:12 -07:00
2014-05-19 09:26:40 +09:30
2014-05-03 19:24:26 -04:00
2014-01-16 11:15:50 +01:00
2014-01-29 20:40:08 +01:00
2014-03-05 17:16:45 +01:00
2014-06-06 16:08:13 -07:00
2014-05-28 16:22:47 +02:00
2014-06-10 23:50:47 -07:00
2014-05-23 15:04:02 -04:00
2014-06-02 16:05:24 -07:00
2014-06-02 14:56:01 -07:00
2014-01-04 20:10:24 -05:00
2014-05-24 00:32:30 -04:00
2013-12-29 16:34:25 -05:00
2014-03-07 11:41:32 -05:00
2014-05-27 14:26:31 -07:00
2014-05-14 16:40:04 -07:00
2014-03-24 14:07:31 +00:00
2014-06-12 13:46:37 +02:00
2014-04-07 16:36:11 -07:00
2014-01-09 13:06:59 +01:00
2014-02-26 14:42:09 -07:00
2014-03-04 17:51:06 +01:00
2014-02-25 15:25:45 -08:00
2014-01-27 21:02:39 -08:00
2014-04-17 12:30:40 -07:00
2014-04-17 12:23:07 -07:00
2014-01-19 19:53:18 -08:00
2014-02-21 21:49:07 +01:00
2014-05-16 14:05:22 +02:00
2014-05-03 23:15:39 +02:00
2014-03-13 12:11:00 +10:30
2014-03-31 00:45:09 -04:00
2014-01-16 00:08:12 +01:00
2014-06-04 16:54:08 -07:00
2014-04-01 11:22:57 -07:00
2014-04-06 09:38:07 -07:00
2014-06-03 08:11:18 -07:00
2014-03-06 16:30:46 +01:00
2014-06-10 10:05:36 -07:00
2014-02-19 14:58:17 +01:00
2014-01-25 08:55:09 +01:00
2014-06-06 16:08:17 -07:00
2014-04-25 12:00:49 -07:00
2014-06-12 19:18:49 -07:00
2014-01-21 16:19:45 -08:00
2014-06-11 12:23:17 -07:00
2014-06-12 19:42:15 -07:00
2014-04-07 16:36:14 -07:00
2014-07-23 10:30:34 -04:00
2014-05-05 16:07:37 -07:00
2014-04-03 16:21:01 -07:00
2014-03-31 14:13:25 -07:00
2013-12-20 12:25:45 -08:00
2014-03-18 19:19:41 -04:00
2014-04-24 05:00:36 +00:00
2014-06-06 16:08:07 -07:00
2014-05-27 17:38:11 -07:00
2014-04-16 15:09:51 -04:00
2013-12-26 13:29:35 -05:00
2014-06-04 16:53:57 -07:00
2014-06-04 16:54:08 -07:00
2014-06-04 16:53:59 -07:00
2013-12-20 12:20:26 -08:00
2014-06-04 16:53:51 -07:00
2014-06-04 16:54:06 -07:00
2014-05-27 17:43:11 -07:00
2014-06-05 08:05:29 -07:00
2014-06-05 08:05:29 -07:00
2014-01-21 16:19:44 -08:00
2014-06-04 16:53:58 -07:00
2014-06-04 16:54:09 -07:00
2014-04-09 13:44:35 -07:00
2014-04-06 09:38:07 -07:00
2014-04-28 11:48:34 +09:30
2014-04-01 23:19:08 -04:00
2014-03-04 13:51:06 -05:00
2014-01-27 21:02:39 -08:00
2014-03-11 12:14:56 +01:00
2014-04-01 23:19:10 -04:00
2014-05-14 00:37:34 -04:00
2014-06-15 01:00:49 -07:00
2014-06-15 01:00:49 -07:00
2014-06-03 23:32:12 -07:00
2014-03-29 17:58:37 -04:00
2014-06-06 19:22:49 -04:00
2014-06-12 10:30:18 -07:00
2014-05-29 11:11:45 -04:00
2014-05-29 11:11:48 -04:00
2014-05-29 11:11:48 -04:00
2014-04-03 16:21:26 -07:00
2014-05-16 17:23:41 -04:00
2014-01-25 03:14:05 -05:00
2014-04-07 10:59:19 -07:00
2014-06-13 10:43:34 -04:00
2014-06-05 15:57:04 -07:00
2014-02-05 10:04:37 -06:00
2014-05-20 15:19:25 -05:00
2014-05-21 11:14:46 +02:00
2014-03-07 16:02:46 +01:00
2014-05-23 11:40:25 +09:00
2014-05-29 15:23:29 -07:00
2014-03-10 22:42:28 -07:00
2014-06-04 04:45:46 -05:00
2014-06-04 08:50:34 -07:00
2014-05-20 14:25:24 -05:00
2014-06-04 10:02:38 -07:00
2014-06-10 14:35:22 -07:00
2014-06-10 14:35:22 -07:00
2014-06-08 13:03:35 -07:00
2014-06-04 16:54:09 -07:00
2014-06-04 16:54:10 -07:00
2014-04-03 16:21:00 -07:00
2014-01-23 16:36:55 -08:00
2014-04-24 15:01:33 -06:00
2014-02-06 17:31:52 +01:00
2014-01-10 14:00:47 -07:00
2014-06-02 16:18:48 -06:00
2014-01-23 20:17:18 +00:00
2014-06-04 12:50:47 -04:00
2014-06-09 14:56:07 -07:00
2014-06-06 07:56:22 +02:00
2014-06-05 15:38:57 -07:00
2014-05-02 16:16:26 -04:00
2014-04-12 14:49:50 -07:00
2014-06-04 16:54:07 -07:00
2014-05-07 00:39:03 +02:00
2014-02-11 00:36:00 +01:00
2014-05-16 23:15:44 +02:00
2014-05-16 23:15:44 +02:00
2014-01-25 23:58:17 -05:00
2014-01-28 08:38:04 -08:00
2014-05-30 13:45:25 +02:00
2014-01-13 17:32:27 +01:00
2014-01-23 14:48:35 +01:00
2014-06-04 16:54:17 -07:00
2014-06-04 16:54:21 -07:00
2013-12-20 13:12:01 -08:00
2014-04-01 16:43:18 -04:00
2014-03-21 14:21:13 -04:00
2014-06-06 16:08:11 -07:00
2014-05-07 10:15:31 +02:00
2014-05-21 11:19:36 +02:00
2014-03-21 18:26:03 +01:00
2014-05-05 17:25:50 +10:00
2014-04-03 16:20:54 -07:00
2014-04-03 16:21:01 -07:00
2014-01-23 16:36:58 -08:00
2014-03-19 22:24:08 -04:00
2014-02-17 15:01:52 -08:00
2014-05-19 10:52:04 -07:00
2014-05-14 09:46:09 -07:00
2014-05-14 09:46:09 -07:00
2014-04-16 08:56:09 +02:00
2014-01-21 23:17:20 -08:00
2014-04-18 16:07:22 +01:00
2014-04-07 16:35:54 -07:00
2014-01-16 12:00:56 -08:00
2014-04-14 16:47:28 +02:00
2014-04-11 09:29:16 +02:00
2014-06-10 09:46:00 -04:00
2014-04-07 16:36:07 -07:00
2014-06-04 16:54:12 -07:00
2014-01-13 13:41:50 +01:00
2014-05-15 15:30:33 -04:00
2014-01-13 13:47:36 +01:00
2014-06-05 10:38:45 +02:00
2014-04-22 13:38:33 -07:00
2014-06-12 19:42:15 -07:00
2014-01-19 19:55:50 -08:00
2014-03-31 00:45:09 -04:00
2014-06-10 10:05:36 -07:00
2014-01-12 10:13:59 +01:00
2014-02-28 16:27:18 -08:00
2014-05-20 15:19:25 -05:00
2014-03-21 04:12:33 +09:00
2014-03-17 16:20:49 -07:00
2014-04-19 22:42:19 -07:00
2014-02-04 10:22:39 +09:00
2014-04-16 12:03:14 +02:00
2014-05-02 21:48:33 +05:30
2014-06-06 16:08:14 -07:00
2014-04-03 16:21:00 -07:00
2014-06-06 16:08:12 -07:00
2014-06-15 01:00:50 -07:00
2014-01-25 11:17:34 -08:00
2014-06-04 16:54:08 -07:00
2014-05-06 13:04:59 -07:00
2014-06-06 16:08:18 -07:00
2014-04-24 13:44:53 -04:00
2014-01-22 21:57:05 -08:00
2014-01-13 13:47:36 +01:00
2014-01-13 13:47:36 +01:00
2014-06-12 00:21:11 -04:00
2014-02-15 11:55:28 -08:00
2014-02-17 15:01:37 -08:00
2014-03-19 08:58:30 +00:00
2014-01-21 17:05:27 -08:00
2014-05-23 11:23:27 +09:00
2014-06-05 15:57:04 -07:00
2014-06-04 16:54:11 -07:00
2014-06-04 16:54:07 -07:00
2014-06-04 16:53:55 -07:00
2014-06-04 16:53:57 -07:00
2014-03-26 16:49:31 -04:00
2014-06-04 16:54:03 -07:00
2014-05-27 14:29:56 -07:00
2014-05-22 12:04:49 -04:00
2014-01-14 08:01:10 -08:00
2014-06-04 16:53:56 -07:00
2014-01-15 23:05:31 +01:00
2014-06-04 16:53:59 -07:00
2014-05-14 09:46:32 -07:00
2014-01-06 14:37:25 +01:00
2014-05-15 11:29:37 -04:00
2014-04-18 14:20:48 +02:00
2014-05-07 12:10:51 -04:00
2014-04-24 16:16:33 -07:00
2014-05-03 18:14:28 -04:00
2014-05-20 16:54:21 -06:00
2014-03-14 22:41:36 -04:00
2014-01-13 13:47:37 +01:00
2014-05-23 16:28:53 -04:00
2014-02-12 15:00:34 -08:00
2014-05-06 17:39:45 -04:00
2014-06-12 19:18:49 -07:00
2014-03-04 15:38:16 -08:00
2014-05-27 16:11:49 -07:00
2014-05-15 17:02:21 +01:00
2014-05-30 11:35:54 -06:00
2014-06-02 12:41:33 -07:00
2014-04-28 11:34:13 +09:30
2014-06-04 16:53:57 -07:00
2014-04-07 16:35:53 -07:00
2014-06-04 16:53:57 -07:00
2014-01-23 16:37:04 -08:00
2014-04-18 16:40:08 -07:00
2014-02-28 14:08:26 -05:00
2014-05-22 11:35:51 -04:00
2014-04-07 16:35:57 -07:00
2014-06-04 16:54:13 -07:00
2014-01-30 16:56:55 -08:00