]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet-rdma: Fix a possible uninitialized variable dereference
authorSagi Grimberg <sagi@grimberg.me>
Thu, 9 Mar 2017 11:45:52 +0000 (13:45 +0200)
committerSagi Grimberg <sagi@grimberg.me>
Thu, 16 Mar 2017 16:41:24 +0000 (18:41 +0200)
commit7977b415dbbddd1b882dabd5caad2eb9c6334e72
tree538602b84c1d1d80f004856550b288d732cdecf8
parentc23486be3364efb9286af474128073e79b28ac9f
nvmet-rdma: Fix a possible uninitialized variable dereference

When handling a new recv command, we grab a new rsp resource and
check for the queue state being live. In case the queue is not in
live state, we simply restore the rsp back to the free list. However
in this flow we didn't set rsp->queue yet, so we cannot dereference it.

Instead, make sure to initialize rsp->queue (and other rsp members)
as soon as possible so we won't reference uninitialized variables.

Reported-by: Yi Zhang <yizhan@redhat.com>
Reported-by: Raju Rangoju <rajur@chelsio.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Raju Rangoju <rajur@chelsio.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/target/rdma.c