]> git.baikalelectronics.ru Git - kernel.git/commit
target: Fix max_unmap_lba_count calc overflow
authorMike Christie <mchristi@redhat.com>
Fri, 3 Jun 2016 01:12:37 +0000 (20:12 -0500)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 20 Jul 2016 07:58:36 +0000 (00:58 -0700)
commit693364c57e1caa153cd8d58da3a81ac3ccc7ad64
tree72beb3f878ba29726a189211cc4e6dacd9a6f339
parent77d7af5b0022f06f414017f58bcefa761680d127
target: Fix max_unmap_lba_count calc overflow

max_discard_sectors only 32bits, and some non scsi backend
devices will set this to the max 0xffffffff, so we can end up
overflowing during the max_unmap_lba_count calculation.

This fixes a regression caused by my patch:

commit 38a1ab449b71c09f0f45fb1d857353d8a3d20d84
Author: Mike Christie <mchristi@redhat.com>
Date:   Mon Jan 18 14:09:27 2016 -0600

    target: Fix WRITE_SAME/DISCARD conversion to linux 512b sectors

which can result in extra discards being sent to due the overflow
causing max_unmap_lba_count to be smaller than what the backing
device can actually support.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_device.c
drivers/target/target_core_file.c
drivers/target/target_core_iblock.c
include/target/target_core_backend.h