Quinn Tran cb43285ff7 qla2xxx: Fix stale pointer access.
[ Upstream Commit 84e32a06f4f8756ce9ec3c8dc7e97896575f0771 ]

Commit 84e32a0 ("qla2xxx: Use pci_enable_msix_range() instead of
pci_enable_msix()") introduced a regression when target mode is enabled.
In qla24xx_enable_msix(), ha->max_rsp_queues was incorrectly set
to a value higher than the number of response queues allocated causing
an invalid dereference. Specifically here in qla2x00_init_rings():
    *rsp->in_ptr = 0;

Add additional check to make sure the pointer is valid. following
call stack will be seen

---- 8< ----
RIP: 0010:[<ffffffffa02ccadc>]  [<ffffffffa02ccadc>] qla2x00_init_rings+0xdc/0x320 [qla2xxx]
RSP: 0018:ffff880429447dd8  EFLAGS: 00010082
....
Call Trace:
[<ffffffffa02ceb40>] qla2x00_abort_isp+0x170/0x6b0 [qla2xxx]
[<ffffffffa02c6f77>] qla2x00_do_dpc+0x357/0x7f0 [qla2xxx]
[<ffffffffa02c6c20>] ? qla2x00_relogin+0x260/0x260 [qla2xxx]
[<ffffffff8107d2c9>] kthread+0xc9/0xe0
[<ffffffff8107d200>] ? flush_kthread_worker+0x90/0x90
[<ffffffff8172cc6f>] ret_from_fork+0x3f/0x70
[<ffffffff8107d200>] ? flush_kthread_worker+0x90/0x90
---- 8< ----

Cc: <stable@vger.kernel.org>
Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2016-02-06 19:44:30 -08:00
..
2016-01-06 21:43:09 -05:00
2016-01-08 12:51:04 -05:00
2015-11-09 17:11:57 -08:00
2015-11-12 07:06:18 -05:00
2015-11-12 07:06:18 -05:00
2016-01-07 15:51:13 -08:00
2015-11-12 07:06:18 -05:00
2015-11-13 20:35:54 -08:00
2015-11-13 20:35:54 -08:00
2015-04-27 10:10:19 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:05:55 -07:00
2015-11-09 17:11:57 -08:00
2015-12-03 09:32:33 -08:00
2015-04-17 10:13:56 -07:00
2015-11-25 22:08:55 -05:00
2016-01-06 21:43:09 -05:00
2015-07-31 13:31:10 +02:00
2014-07-17 22:07:37 +02:00
2016-01-06 21:43:09 -05:00
2015-11-09 17:11:57 -08:00
2014-11-24 16:13:16 +01:00
2015-11-09 16:32:14 -08:00
2016-01-06 21:43:13 -05:00
2016-01-06 21:43:13 -05:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2015-12-03 09:32:33 -08:00
2016-01-07 15:51:13 -08:00
2016-01-08 13:08:15 -05:00
2015-06-02 17:24:54 -07:00
2013-04-09 14:13:27 -04:00
2016-01-06 21:43:09 -05:00
2013-04-09 14:13:15 -04:00
2014-07-17 22:07:35 +02:00
2014-11-24 20:01:28 +01:00
2016-01-06 21:43:09 -05:00
2015-11-12 07:06:18 -05:00
2015-12-02 16:43:11 -05:00
2016-01-07 15:51:13 -08:00
2015-09-02 12:22:54 -07:00
2015-11-30 11:23:45 -05:00
2014-07-17 22:07:39 +02:00
2014-11-24 20:01:28 +01:00
2014-11-12 11:15:57 +01:00
2015-12-03 09:32:33 -08:00
2015-11-18 11:59:09 -05:00
2015-11-09 17:42:19 -08:00
2014-11-20 09:11:15 +01:00
2016-01-06 21:43:09 -05:00
2015-07-23 13:07:04 -07:00
2013-04-09 14:13:15 -04:00