Fix NULL pointer dereference in bl_free_device().
authorArtem Savkov <asavkov@redhat.com>
Thu, 21 Jul 2016 11:32:04 +0000 (13:32 +0200)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 22 Jul 2016 19:14:21 +0000 (15:14 -0400)
commit297fae4d0bee5d683533f3324baf1b363e7b48bf
treedcb38bff8298ea9cb0dd8bfcccb42d05c83372ba
parentc77efc1e7884c818ba67ec36b08e220202d9428c
Fix NULL pointer dereference in bl_free_device().

When bl_parse_deviceid() fails in bl_alloc_deviceid_node() on
blkdev_get_by_*() step we get an pnfs_block_dev struct that is
uninitialized except for bdev field which is set to whatever error
blkdev_get_by_*() returns.  bl_free_device() then tries to call
blkdev_put() if bdev is not 0 resulting in a wrong pointer dereference.

Fixing this by setting bdev in struct pnfs_block_dev only if we didn't
get an error from blkdev_get_by_*().

Signed-off-by: Artem Savkov <asavkov@redhat.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/blocklayout/dev.c
This page took 0.024768 seconds and 5 git commands to generate.