Skip to content

Commit aeacfce

Browse files
cleechChristoph Hellwig
authored andcommitted
nvme-tcp: fence TCP socket on receive error
Ensure that no further socket reads occur after a receive processing error, either from io_work being re-scheduled or nvme_tcp_poll. Failing to do so can result in unrecognised PDU payloads or TCP stream garbage being processed as a C2H data PDU, and potentially start copying the payload to an invalid destination after looking up a request using a bogus command id. Signed-off-by: Chris Leech <cleech@redhat.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: John Meneghini <jmeneghi@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent c5a9abf commit aeacfce

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/nvme/host/tcp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ static int nvme_tcp_recv_skb(read_descriptor_t *desc, struct sk_buff *skb,
876876
size_t consumed = len;
877877
int result;
878878

879+
if (unlikely(!queue->rd_enabled))
880+
return -EFAULT;
881+
879882
while (len) {
880883
switch (nvme_tcp_recv_state(queue)) {
881884
case NVME_TCP_RECV_PDU:

0 commit comments

Comments
 (0)