public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space
@ 2016-12-02 17:33 Quentin Lambert
  2016-12-05 20:52 ` Dan Carpenter
  2016-12-05 22:58 ` [lustre-devel] " Oleg Drokin
  0 siblings, 2 replies; 12+ messages in thread
From: Quentin Lambert @ 2016-12-02 17:33 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman,
	lustre-devel, devel, linux-kernel, kernel-janitors
  Cc: Quentin Lambert

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@gmail.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);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-12-07 19:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-02 17:33 [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space Quentin Lambert
2016-12-05 20:52 ` Dan Carpenter
2016-12-05 22:58 ` [lustre-devel] " Oleg Drokin
2016-12-06 13:48   ` Quentin Lambert
2016-12-07 15:20     ` Quentin Lambert
2016-12-07 15:32       ` Dan Carpenter
2016-12-07 15:33       ` Dan Carpenter
2016-12-07 15:42         ` Quentin Lambert
2016-12-07 19:22           ` Dan Carpenter
2016-12-07 19:52             ` James Simmons
2016-12-07 17:10         ` Oleg Drokin
2016-12-07 17:22       ` Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox