Skip to content

Commit 89e637c

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: RDMA/srp: Fix residual handling
Although the code for residual handling in the SRP initiator follows the SCSI documentation, that documentation has never been correct. Because scsi_finish_command() starts from the data buffer length and subtracts the residual, scsi_set_resid() must not be called if a residual overflow occurs. Hence remove the scsi_set_resid() calls from the SRP initiator if a residual overflow occurrs. Cc: Leon Romanovsky <leon@kernel.org> Cc: Jason Gunthorpe <jgg@nvidia.com> Fixes: 9237f04 ("scsi: core: Fix scsi_get/set_resid() interface") Fixes: e714531 ("IB/srp: Fix residual handling") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230724200843.3376570-3-bvanassche@acm.org Acked-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 2903265 commit 89e637c

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

drivers/infiniband/ulp/srp/ib_srp.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,12 +1979,8 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)
19791979

19801980
if (unlikely(rsp->flags & SRP_RSP_FLAG_DIUNDER))
19811981
scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt));
1982-
else if (unlikely(rsp->flags & SRP_RSP_FLAG_DIOVER))
1983-
scsi_set_resid(scmnd, -be32_to_cpu(rsp->data_in_res_cnt));
19841982
else if (unlikely(rsp->flags & SRP_RSP_FLAG_DOUNDER))
19851983
scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt));
1986-
else if (unlikely(rsp->flags & SRP_RSP_FLAG_DOOVER))
1987-
scsi_set_resid(scmnd, -be32_to_cpu(rsp->data_out_res_cnt));
19881984

19891985
srp_free_req(ch, req, scmnd,
19901986
be32_to_cpu(rsp->req_lim_delta));

0 commit comments

Comments
 (0)