[PATCH v2] nvme-tcp: fix connect failure on receiving partial ICResp PDU

Caleb Sander csander at purestorage.com
Fri Jan 24 09:33:16 PST 2025


Good catch! I will send a v3.

On Fri, Jan 24, 2025 at 12:08 AM Maurizio Lombardi <mlombard at redhat.com> wrote:
>
> čt 23. 1. 2025 v 23:50 odesílatel Caleb Sander Mateos
> <csander at purestorage.com> napsal:
> >
> >         ret = kernel_recvmsg(queue->sock, &msg, &iov, 1,
> >                         iov.iov_len, msg.msg_flags);
> > -       if (ret < 0) {
> > +       if (ret < sizeof(*icresp)) {
> >                 pr_warn("queue %d: failed to receive icresp, error %d\n",
> >                         nvme_tcp_queue_id(queue), ret);
> >                 goto free_icresp;
> >         }
>
> There is a small problem here, suppose ret is a positive number but
> smaller than sizeof(*icresp),
> you will print a bogus error code, then you "goto free_icresp;" and
> return this random positive number to the caller.
>
> I think that if ret > 0 you should set it to -EINVAL.
>
> Maurizio
>



More information about the Linux-nvme mailing list