]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet-tcp: Fix NULL dereference when a connect data comes in h2cdata pdu
authorZiye Yang <ziye.yang@intel.com>
Fri, 21 Aug 2020 16:48:10 +0000 (00:48 +0800)
committerSagi Grimberg <sagi@grimberg.me>
Fri, 28 Aug 2020 23:43:56 +0000 (16:43 -0700)
commit9774976dafd5f7f7c7875c3c294a84abe8c91dd7
tree79c7391c7d8fc53c5b9cdb084eac3e216987b00c
parente52074f8627610d9bf7c70335c696ffedb2f547f
nvmet-tcp: Fix NULL dereference when a connect data comes in h2cdata pdu

When handling commands without in-capsule data, we assign the ttag
assuming we already have the queue commands array allocated (based
on the queue size information in the connect data payload). However
if the connect itself did not send the connect data in-capsule we
have yet to allocate the queue commands,and we will assign a bogus
ttag and suffer a NULL dereference when we receive the corresponding
h2cdata pdu.

Fix this by checking if we already allocated commands before
dereferencing it when handling h2cdata, if we didn't, its for sure a
connect and we should use the preallocated connect command.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/target/tcp.c