summaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-03-26 17:18:44 +0200
committerIngo Molnar <mingo@kernel.org>2012-03-26 17:19:03 +0200
commit7fd52392c56361a40f0c630a82b36b95ca31eac6 (patch)
tree14091de24c6b28ea4cae9826f98aeedb7be091f5 /net/sctp/socket.c
parentperf: Move mmap page data_head offset assertion out of header (diff)
parentMerge tag 'stable/for-linus-3.4-tag-two' of git://git.kernel.org/pub/scm/linu... (diff)
downloadlinux-7fd52392c56361a40f0c630a82b36b95ca31eac6.tar.xz
linux-7fd52392c56361a40f0c630a82b36b95ca31eac6.zip
Merge branch 'linus' into perf/urgent
Merge reason: we need to fix a non-trivial merge conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 408ebd0e7330..06b42b7f5a02 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4170,14 +4170,16 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
}
/* Helper routine to branch off an association to a new socket. */
-SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
- struct socket **sockp)
+int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp)
{
- struct sock *sk = asoc->base.sk;
+ struct sctp_association *asoc = sctp_id2assoc(sk, id);
struct socket *sock;
struct sctp_af *af;
int err = 0;
+ if (!asoc)
+ return -EINVAL;
+
/* An association cannot be branched off from an already peeled-off
* socket, nor is this supported for tcp style sockets.
*/
@@ -4206,13 +4208,13 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
return err;
}
+EXPORT_SYMBOL(sctp_do_peeloff);
static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval, int __user *optlen)
{
sctp_peeloff_arg_t peeloff;
struct socket *newsock;
int retval = 0;
- struct sctp_association *asoc;
if (len < sizeof(sctp_peeloff_arg_t))
return -EINVAL;
@@ -4220,15 +4222,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
if (copy_from_user(&peeloff, optval, len))
return -EFAULT;
- asoc = sctp_id2assoc(sk, peeloff.associd);
- if (!asoc) {
- retval = -EINVAL;
- goto out;
- }
-
- SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p\n", __func__, sk, asoc);
-
- retval = sctp_do_peeloff(asoc, &newsock);
+ retval = sctp_do_peeloff(sk, peeloff.associd, &newsock);
if (retval < 0)
goto out;
@@ -4239,8 +4233,8 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
goto out;
}
- SCTP_DEBUG_PRINTK("%s: sk: %p asoc: %p newsk: %p sd: %d\n",
- __func__, sk, asoc, newsock->sk, retval);
+ SCTP_DEBUG_PRINTK("%s: sk: %p newsk: %p sd: %d\n",
+ __func__, sk, newsock->sk, retval);
/* Return the fd mapped to the new socket. */
peeloff.sd = retval;