staging: lustre: lnet/selftest: don't ignore status from lstcon_test_add
authorNeilBrown <neilb@suse.com>
Thu, 22 Feb 2018 22:09:33 +0000 (09:09 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Feb 2018 13:45:10 +0000 (14:45 +0100)
If lstcon_test_add sets 'ret' (passed by reference) to 1,
then lst_test_add_ioctl() ignores the return value.
This isn't justified - the return value must be zero for 'ret'
to be meaningful.

Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/selftest/conctl.c

index 51497cf9a8326746ff6451a2d5a81f9a424a1634..a2d8092bdeb79b10ce3bd412dbb51bd748d670f8 100644 (file)
@@ -670,7 +670,7 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
                             args->lstio_tes_param_len,
                             &ret, args->lstio_tes_resultp);
 
-       if (ret)
+       if (!rc && ret)
                rc = (copy_to_user(args->lstio_tes_retp, &ret,
                                   sizeof(ret))) ? -EFAULT : 0;
 out: