[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130318105503.GA17102@longonot.mountain>
Date: Mon, 18 Mar 2013 13:55:03 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "David S. Miller" <davem@...emloft.net>,
David Howells <dhowells@...hat.com>
Cc: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] RxRPC: use copy_to_user() instead of memcpy()
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@...cle.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);
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists