dm flakey: return -EINVAL on interval bounds error in flakey_ctr()
authorWei Yongjun <weiyj.lk@gmail.com>
Mon, 8 Aug 2016 14:09:27 +0000 (14:09 +0000)
committerMike Snitzer <snitzer@redhat.com>
Mon, 21 Nov 2016 14:52:07 +0000 (09:52 -0500)
Fix to return error code -EINVAL instead of 0, as is done elsewhere in
this function.

Fixes: e80d1c805a3b ("dm: do not override error code returned from dm_get_device()")
Cc: stable@vger.kernel.org # 4.3+
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-flakey.c

index 6a2e8dd44a1b83b8fb45a4532458db3fb58db526..3643cba713518e9fdba01662c3516491bdb7d047 100644 (file)
@@ -200,11 +200,13 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
        if (!(fc->up_interval + fc->down_interval)) {
                ti->error = "Total (up + down) interval is zero";
+               r = -EINVAL;
                goto bad;
        }
 
        if (fc->up_interval + fc->down_interval < fc->up_interval) {
                ti->error = "Interval overflow";
+               r = -EINVAL;
                goto bad;
        }