iscsi-target: Fix iov_count calculation bug in iscsit_allocate_iovecs

This patch fixes a bug in iscsit_allocate_iovecs() where iov_count was
incorrectly calculated using min(1UL, data_length / PAGE_SIZE) instead of
max(1UL, data_length / PAGE_SIZE), that ends up triggering an OOPs for
large block I/O when the SGL <-> iovec mapping exceeds the bogus iov_count
allocation size.

This is a regression introduced during the iscsi-target conversion back
to using core memory allocation here:

commit e03470f98341a61bb31c8655e83b11f6f4934499
Author: Andy Grover <>
Date:   Tue Apr 3 15:51:29 2012 -0700

    target/iscsi: Go back to core allocating data buffer for cmd

Cc: Andy Grover <>
Signed-off-by: Nicholas Bellinger <>
1 file changed