[PATCH V3 2/3] nvmet_auth: use common helper for buffer alloc

Sagi Grimberg sagi at grimberg.me
Mon Jun 5 15:02:08 PDT 2023



On 6/5/23 12:19, Chaitanya Kulkarni wrote:
> Add a common helper to factor out buffer allocation in
> nvmet_execute_auth_send() and nvmet_execute_auth_receive() and call it
> from nvmet_auth_common_prep() once we done with the secp/spsp0/spsp1
> check.
> 
> Only functional change in this patch is transfer buffer allocation is
> moved before nvmet_check_transfer_len() and it is freed if when
> nvmet_check_transfer_len() fails. But similar allocation and free is
> used in error unwind path in nvme code and it is not in fast path, so
> it shuold be fine.

This is asking for a future memory leak. It kinda makes sense to
allocate after we run sanity checks on the request...



More information about the Linux-nvme mailing list