]> git.karo-electronics.de Git - karo-tx-linux.git/commit
target: Fix divide by zero bug in fabric_max_sectors for unconfigured devices
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 19 Feb 2013 03:15:14 +0000 (03:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2013 17:21:24 +0000 (09:21 -0800)
commitca2656dccef64c437d6717468bffd3762b11816e
tree646b4d2f724f032e675e6122925f5b32e02111d8
parent732b2a1a4bb58677ba9c7be3fac0960ceccc9b8f
target: Fix divide by zero bug in fabric_max_sectors for unconfigured devices

commit 7a3cf6ca1ab2a2f7161c6dec5a787fc7a5de864e upstream

This patch fixes a possible divide by zero bug when the fabric_max_sectors
device attribute is written and backend se_device failed to be successfully
configured -> enabled.

Go ahead and use block_size=512 within se_dev_set_fabric_max_sectors()
in the event of a target_configure_device() failure case, as no valid
dev->dev_attrib.block_size value will have been setup yet.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_device.c