netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] caif: don't set connection request param size before copying data
@ 2011-01-10 23:36 Dan Rosenberg
  2011-01-11  0:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Rosenberg @ 2011-01-10 23:36 UTC (permalink / raw)
  To: Sjur Braendeland, David S. Miller; +Cc: netdev

The size field should not be set until after the data is successfully
copied in.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
---
 net/caif/caif_socket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 1bf0cf5..8184c03 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -740,12 +740,12 @@ static int setsockopt(struct socket *sock,
 		if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL)
 			return -ENOPROTOOPT;
 		lock_sock(&(cf_sk->sk));
-		cf_sk->conn_req.param.size = ol;
 		if (ol > sizeof(cf_sk->conn_req.param.data) ||
 			copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) {
 			release_sock(&cf_sk->sk);
 			return -EINVAL;
 		}
+		cf_sk->conn_req.param.size = ol;
 		release_sock(&cf_sk->sk);
 		return 0;
 



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

* Re: [PATCH] caif: don't set connection request param size before copying data
  2011-01-10 23:36 [PATCH] caif: don't set connection request param size before copying data Dan Rosenberg
@ 2011-01-11  0:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-11  0:01 UTC (permalink / raw)
  To: drosenberg; +Cc: sjur.brandeland, netdev

From: Dan Rosenberg <drosenberg@vsecurity.com>
Date: Mon, 10 Jan 2011 18:36:37 -0500

> The size field should not be set until after the data is successfully
> copied in.
> 
> Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>

Applied, thanks.

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

end of thread, other threads:[~2011-01-11  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 23:36 [PATCH] caif: don't set connection request param size before copying data Dan Rosenberg
2011-01-11  0:01 ` David Miller

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