[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161202173332.5100-1-lambert.quentin@gmail.com>
Date: Fri, 2 Dec 2016 18:33:32 +0100
From: Quentin Lambert <lambert.quentin@...il.com>
To: Oleg Drokin <oleg.drokin@...el.com>,
Andreas Dilger <andreas.dilger@...el.com>,
James Simmons <jsimmons@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
lustre-devel@...ts.lustre.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Cc: Quentin Lambert <lambert.quentin@...il.com>
Subject: [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space
lnet_ipif_enumerate was assigning a pointer from kernel space to user
space. This patch uses copy_to_user to properly do that assignment.
Signed-off-by: Quentin Lambert <lambert.quentin@...il.com>
---
shouldn't we be using ifc_req instead of ifc_buf?
drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -181,7 +181,13 @@ lnet_ipif_enumerate(char ***namesp)
goto out0;
}
- ifc.ifc_buf = (char *)ifr;
+ rc = copy_to_user(ifc.ifc_buf, (char *)ifr,
+ nalloc * sizeof(*ifr));
+ if (rc) {
+ rc = -ENOMEM;
+ goto out1;
+ }
+
ifc.ifc_len = nalloc * sizeof(*ifr);
rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
Powered by blists - more mailing lists