public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Lambert <lambert.quentin@gmail.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: Quentin Lambert <lambert.quentin@gmail.com>
Subject: [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space
Date: Fri,  2 Dec 2016 18:33:32 +0100	[thread overview]
Message-ID: <20161202173332.5100-1-lambert.quentin@gmail.com> (raw)

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);

             reply	other threads:[~2016-12-02 17:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 17:33 Quentin Lambert [this message]
2016-12-05 20:52 ` [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161202173332.5100-1-lambert.quentin@gmail.com \
    --to=lambert.quentin@gmail.com \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox