mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
NVMe: Protect against badly formatted CQEs
If a misbehaving device posts a CQE with a command id < depth but for one that was never allocated, the command info will have a callback function set to NULL and we don't want to try invoking that. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
This commit is contained in:
parent
27e8166c31
commit
94bbac4052
@ -243,8 +243,9 @@ static void *free_cmdid(struct nvme_queue *nvmeq, int cmdid,
|
||||
void *ctx;
|
||||
struct nvme_cmd_info *info = nvme_cmd_info(nvmeq);
|
||||
|
||||
if (cmdid >= nvmeq->q_depth) {
|
||||
*fn = special_completion;
|
||||
if (cmdid >= nvmeq->q_depth || !info[cmdid].fn) {
|
||||
if (fn)
|
||||
*fn = special_completion;
|
||||
return CMD_CTX_INVALID;
|
||||
}
|
||||
if (fn)
|
||||
|
Loading…
Reference in New Issue
Block a user