diff options
author | Sebastian Siewior <sebastian@breakpoint.cc> | 2007-07-27 22:55:59 +0200 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-08-01 11:19:06 -0400 |
commit | d6f9fdaf643eca8fb49fffdd6269b78f4ef1ef86 (patch) | |
tree | 785178ed69f6e7c24f929f439bfde1972c95dce7 /net/sctp/socket.c | |
parent | c86dabcf00f3ca167df59f3526a53b3da3ede2c8 (diff) | |
download | talos-op-linux-d6f9fdaf643eca8fb49fffdd6269b78f4ef1ef86.tar.gz talos-op-linux-d6f9fdaf643eca8fb49fffdd6269b78f4ef1ef86.zip |
sctp: try to fix readlock
unlock the reader lock in error case.
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index b31be0994572..be743d4a7c09 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -4350,7 +4350,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, space_left, &bytes_copied); if (cnt < 0) { err = cnt; - goto error; + goto error_lock; } goto copy_getaddrs; } @@ -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; if (space_left < addrlen) { err = -ENOMEM; /*fixme: right error?*/ - goto error; + goto error_lock; } memcpy(buf, &temp, addrlen); buf += addrlen; @@ -4378,15 +4378,21 @@ copy_getaddrs: if (copy_to_user(to, addrs, bytes_copied)) { err = -EFAULT; - goto error; + goto out; } if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { err = -EFAULT; - goto error; + goto out; } if (put_user(bytes_copied, optlen)) err = -EFAULT; -error: + + goto out; + +error_lock: + sctp_read_unlock(addr_lock); + +out: kfree(addrs); return err; } |