Commit 91b5c98c authored by Dan Rosenberg's avatar Dan Rosenberg Committed by David S. Miller
Browse files

caif: don't set connection request param size before copying data

The size field should not be set until after the data is successfully
copied in.
Signed-off-by: default avatarDan Rosenberg <>
Signed-off-by: default avatarDavid S. Miller <>
parent 80ce3f67
...@@ -740,12 +740,12 @@ static int setsockopt(struct socket *sock, ...@@ -740,12 +740,12 @@ static int setsockopt(struct socket *sock,
if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL) if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL)
lock_sock(&(cf_sk->sk)); lock_sock(&(cf_sk->sk));
cf_sk->conn_req.param.size = ol;
if (ol > sizeof(cf_sk-> || if (ol > sizeof(cf_sk-> ||
copy_from_user(&cf_sk->, ov, ol)) { copy_from_user(&cf_sk->, ov, ol)) {
release_sock(&cf_sk->sk); release_sock(&cf_sk->sk);
return -EINVAL; return -EINVAL;
} }
cf_sk->conn_req.param.size = ol;
release_sock(&cf_sk->sk); release_sock(&cf_sk->sk);
return 0; return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment