From: Zhihao Cheng Date: Fri, 11 Nov 2022 12:10:27 +0000 (+0800) Subject: dm bufio: Fix missing decrement of no_sleep_enabled if dm_bufio_client_create failed X-Git-Tag: v6.6.17~6165^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0dfc1f4ceae86a0d09d880ab87625c86c61ed33c;p=platform%2Fkernel%2Flinux-rpi.git dm bufio: Fix missing decrement of no_sleep_enabled if dm_bufio_client_create failed The 'no_sleep_enabled' should be decreased in error handling path in dm_bufio_client_create() when the DM_BUFIO_CLIENT_NO_SLEEP flag is set, otherwise static_branch_unlikely() will always return true even if no dm_bufio_client instances have DM_BUFIO_CLIENT_NO_SLEEP flag set. Cc: stable@vger.kernel.org Fixes: 3c1c875d0586 ("dm bufio: conditionally enable branching for DM_BUFIO_CLIENT_NO_SLEEP") Signed-off-by: Zhihao Cheng Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 9c5ef81..bb786c3 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1858,6 +1858,8 @@ bad: dm_io_client_destroy(c->dm_io); bad_dm_io: mutex_destroy(&c->lock); + if (c->no_sleep) + static_branch_dec(&no_sleep_enabled); kfree(c); bad_client: return ERR_PTR(r);