Prasad J Pandit 49adc5d3f8 scsi: pvscsi: limit loop to fetch SG list
In PVSCSI paravirtual SCSI bus, pvscsi_convert_sglist can take a very
long time or go into an infinite loop due to two different bugs:

1) the request descriptor data length is defined to be 64 bit. While
building SG list from a request descriptor, it gets truncated to 32bit
in routine 'pvscsi_convert_sglist'. This could lead to an infinite loop
situation large 'dataLen' values when data_length is cast to uint32_t and
chunk_size becomes always zero.  Fix this by removing the incorrect cast.

2) pvscsi_get_next_sg_elem can be called arbitrarily many times if the
element has a zero length.  Get out of the loop early when this happens,
by introducing an upper limit on the number of SG list elements.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <1473108643-12983-1-git-send-email-ppandit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-09-13 19:08:47 +02:00
..
2016-09-08 18:05:21 +04:00
2016-09-08 18:05:21 +04:00
2016-09-08 18:05:21 +04:00
2016-09-08 18:05:22 +04:00
2016-06-17 16:33:48 +10:00
2016-09-08 18:05:21 +04:00
2016-06-14 15:59:13 +01:00
2016-09-09 20:58:34 +03:00
2016-09-08 18:05:21 +04:00
2016-09-08 18:05:21 +04:00
2016-05-18 15:04:27 +03:00
2016-09-08 18:05:22 +04:00
2016-09-08 18:05:21 +04:00
2016-09-08 11:28:12 +01:00
2016-07-29 00:07:09 +03:00
2016-01-29 15:07:25 +00:00
2016-09-08 18:05:22 +04:00
2016-06-24 05:13:57 +03:00
2015-12-22 18:39:19 +02:00