Commit d6f9fdaf authored by Sebastian Siewior's avatar Sebastian Siewior Committed by Vlad Yasevich

sctp: try to fix readlock

unlock the reader lock in error case.
Signed-off-by: default avatarSebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
parent c86dabcf
...@@ -4350,7 +4350,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, ...@@ -4350,7 +4350,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
space_left, &bytes_copied); space_left, &bytes_copied);
if (cnt < 0) { if (cnt < 0) {
err = cnt; err = cnt;
goto error; goto error_lock;
} }
goto copy_getaddrs; goto copy_getaddrs;
} }
...@@ -4364,7 +4364,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, ...@@ -4364,7 +4364,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
if (space_left < addrlen) { if (space_left < addrlen) {
err = -ENOMEM; /*fixme: right error?*/ err = -ENOMEM; /*fixme: right error?*/
goto error; goto error_lock;
} }
memcpy(buf, &temp, addrlen); memcpy(buf, &temp, addrlen);
buf += addrlen; buf += addrlen;
...@@ -4378,15 +4378,21 @@ copy_getaddrs: ...@@ -4378,15 +4378,21 @@ copy_getaddrs:
if (copy_to_user(to, addrs, bytes_copied)) { if (copy_to_user(to, addrs, bytes_copied)) {
err = -EFAULT; err = -EFAULT;
goto error; goto out;
} }
if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
err = -EFAULT; err = -EFAULT;
goto error; goto out;
} }
if (put_user(bytes_copied, optlen)) if (put_user(bytes_copied, optlen))
err = -EFAULT; err = -EFAULT;
error:
goto out;
error_lock:
sctp_read_unlock(addr_lock);
out:
kfree(addrs); kfree(addrs);
return err; return err;
} }
......
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