diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2015-05-01 15:23:49 +0900 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-05-30 22:42:24 -0700 |
commit | 5835812f13e56483f2c4907664bb43b0a78546b6 (patch) | |
tree | 229ed3b47ab6f80936c063b5b92bfe6bf7c736e5 /lib/crc-t10dif.c | |
parent | 57636388af32c2c7db3919e8d53f4979b7c7c307 (diff) | |
download | lwn-5835812f13e56483f2c4907664bb43b0a78546b6.tar.gz lwn-5835812f13e56483f2c4907664bb43b0a78546b6.zip |
target: ensure se_cmd->t_prot_sg is allocated when required
Even if the device backend is initialized with protection info is
enabled, some requests don't have the protection info attached for
WRITE SAME command issued by block device helpers, WRITE command with
WRPROTECT=0 by SG_IO ioctl, etc.
So when TCM loopback fabric module is used, se_cmd->t_prot_sg is NULL
for these requests and performing WRITE_INSERT of PI using software
emulation by sbc_dif_generate() causes kernel crash.
To fix this, introduce SCF_PASSTHROUGH_PROT_SG_TO_MEM_NOALLOC for
se_cmd_flags, which is used to determine that se_cmd->t_prot_sg needs
to be allocated or use pre-allocated protection information by scsi
mid-layer.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: target-devel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'lib/crc-t10dif.c')
0 files changed, 0 insertions, 0 deletions