From: Dan Carpenter <dan.carpenter@oracle.com>
To: "David S. Miller" <davem@davemloft.net>,
David Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] RxRPC: use copy_to_user() instead of memcpy()
Date: Mon, 18 Mar 2013 10:55:03 +0000 [thread overview]
Message-ID: <20130318105503.GA17102@longonot.mountain> (raw)
This is a user pointer. Changing the memcpy() to copy_to_user()
fixes a hang on my system.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I'm not very familiar with this code, so please review this
carefully.
diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c
index 4b48687..428501f 100644
--- a/net/rxrpc/ar-recvmsg.c
+++ b/net/rxrpc/ar-recvmsg.c
@@ -143,10 +143,15 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock,
/* copy the peer address and timestamp */
if (!continue_call) {
- if (msg->msg_name && msg->msg_namelen > 0)
- memcpy(msg->msg_name,
- &call->conn->trans->peer->srx,
- sizeof(call->conn->trans->peer->srx));
+ if (msg->msg_name && msg->msg_namelen > 0) {
+ ret = copy_to_user((void __user *)msg->msg_name,
+ &call->conn->trans->peer->srx,
+ sizeof(call->conn->trans->peer->srx));
+ if (ret) {
+ ret = -EFAULT;
+ goto copy_error;
+ }
+ }
sock_recv_ts_and_drops(msg, &rx->sk, skb);
}
next reply other threads:[~2013-03-18 10:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 10:55 Dan Carpenter [this message]
2013-03-19 13:42 ` [patch] RxRPC: use copy_to_user() instead of memcpy() David Miller
2013-03-19 13:59 ` David Howells
2013-03-19 22:51 ` Dan Carpenter
2013-03-20 10:23 ` David Howells
2013-03-20 15:52 ` Dan Carpenter
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=20130318105503.GA17102@longonot.mountain \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).