]> git.baikalelectronics.ru Git - kernel.git/commit
IB/isert: Fix unaligned immediate-data handling
authorSagi Grimberg <sagi@grimberg.me>
Fri, 4 Sep 2020 19:50:39 +0000 (12:50 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 9 Sep 2020 16:46:03 +0000 (13:46 -0300)
commit266f5a701c450af6768f036837e847e73fc733a8
tree44936c440256e1321a86e3f228599065ec6be1d0
parentecf61d130cff4199a5f3693d9d364d8a50e4c78f
IB/isert: Fix unaligned immediate-data handling

Currently we allocate rx buffers in a single contiguous buffers for
headers (iser and iscsi) and data trailer. This means that most likely the
data starting offset is aligned to 76 bytes (size of both headers).

This worked fine for years, but at some point this broke, resulting in
data corruptions in isert when a command comes with immediate data and the
underlying backend device assumes 512 bytes buffer alignment.

We assume a hard-requirement for all direct I/O buffers to be 512 bytes
aligned. To fix this, we should avoid passing unaligned buffers for I/O.

Instead, we allocate our recv buffers with some extra space such that we
can have the data portion align to 512 byte boundary. This also means that
we cannot reference headers or data using structure but rather
accessors (as they may move based on alignment). Also, get rid of the
wrong __packed annotation from iser_rx_desc as this has only harmful
effects (not aligned to anything).

This affects the rx descriptors for iscsi login and data plane.

Fixes: 9c36141d5abe ("block: introduce multi-page bvec helpers")
Link: https://lore.kernel.org/r/20200904195039.31687-1-sagi@grimberg.me
Reported-by: Stephen Rust <srust@blockbridge.com>
Tested-by: Doug Dumitru <doug@dumitru.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/ulp/isert/ib_isert.c
drivers/infiniband/ulp/isert/ib_isert.h