mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
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: Dan Rosenberg <drosenberg@vsecurity.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
80ce3f67e7
commit
91b5c98c2e
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user