* [PATCH] staging: lustre: selftest: freeing an error pointer
@ 2018-02-22 9:15 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-02-22 9:15 UTC (permalink / raw)
To: lustre-devel
We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.
Fixes: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c
index 3c919a536e91..51497cf9a832 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -650,10 +650,8 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
if (args->lstio_tes_param) {
param = memdup_user(args->lstio_tes_param,
args->lstio_tes_param_len);
- if (IS_ERR(param)) {
- rc = PTR_ERR(param);
- goto out;
- }
+ if (IS_ERR(param))
+ return PTR_ERR(param);
}
rc = -EFAULT;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [lustre-devel] [PATCH] staging: lustre: selftest: freeing an error pointer
@ 2018-02-22 9:15 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-02-22 9:15 UTC (permalink / raw)
To: lustre-devel
We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.
Fixes: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c
index 3c919a536e91..51497cf9a832 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -650,10 +650,8 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
if (args->lstio_tes_param) {
param = memdup_user(args->lstio_tes_param,
args->lstio_tes_param_len);
- if (IS_ERR(param)) {
- rc = PTR_ERR(param);
- goto out;
- }
+ if (IS_ERR(param))
+ return PTR_ERR(param);
}
rc = -EFAULT;
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-22 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-22 9:15 [PATCH] staging: lustre: selftest: freeing an error pointer Dan Carpenter
2018-02-22 9:15 ` [lustre-devel] " Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.