[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFL455=TMmKVZPtnX_CBF34+EtfMbq37OxQAFGJuW_u1VjEQsA@mail.gmail.com>
Date: Fri, 24 Jan 2025 09:08:42 +0100
From: Maurizio Lombardi <mlombard@...hat.com>
To: Caleb Sander Mateos <csander@...estorage.com>
Cc: Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...nel.dk>, Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>, linux-nvme@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] nvme-tcp: fix connect failure on receiving partial
ICResp PDU
čt 23. 1. 2025 v 23:50 odesílatel Caleb Sander Mateos
<csander@...estorage.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
Powered by blists - more mailing lists