From: Bart Van Assche <[email protected]>

Only unlock dax_dev_rwsem if it has been locked. This locking bug was
detected by the Clang thread-safety analyzer.

Cc: Dan Williams <[email protected]>
Cc: Vishal Verma <[email protected]>
Cc: Dave Jiang <[email protected]>
Cc: Alison Schofield <[email protected]>
Cc: [email protected]
Cc: [email protected]
Fixes: c05ae9d85b47 ("dax/bus.c: replace driver-core lock usage by a local 
rwsem")
Signed-off-by: Bart Van Assche <[email protected]>
---
 drivers/dax/bus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index c94c09622516..ebd3806c34e5 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -1117,11 +1117,10 @@ static ssize_t size_store(struct device *dev, struct 
device_attribute *attr,
        }
        rc = down_write_killable(&dax_dev_rwsem);
        if (rc)
-               goto err_dev;
+               goto err_region;
 
        rc = dev_dax_resize(dax_region, dev_dax, val);
 
-err_dev:
        up_write(&dax_dev_rwsem);
 err_region:
        up_write(&dax_region_rwsem);

Reply via email to