aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-05-10 22:35:55 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2023-05-30 00:16:58 +0300
commitbea933e430249fb81e1c020ddf50511d0481d56e (patch)
treedbd9d86d59c4707a8cc25bc67c354dbb5f197229 /block.c
parentdabb4183d17dc11c44d7deb840151b79a53673af (diff)
block/export: Fix null pointer dereference in error path
There are some error paths in blk_exp_add() that jump to 'fail:' before 'exp' is even created. So we can't just unconditionally access exp->blk. Add a NULL check, and switch from exp->blk to blk, which is available earlier, just to be extra sure that we really cover all cases where BlockDevOps could have been set for it (in practice, this only happens in drv->create() today, so this part of the change isn't strictly necessary). Fixes: Coverity CID 1509238 Fixes: de79b52604e43fdeba6cee4f5af600b62169f2d2 Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230510203601.418015-3-kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit a184563778f2b8970eb93291f08108e66432a575) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'block.c')
0 files changed, 0 insertions, 0 deletions