Merge tag 'v6.5-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-microblaze.git] / net / sctp / socket.c
index cda8c28..6554a35 100644 (file)
@@ -4895,7 +4895,7 @@ out:
 }
 
 /* The SCTP ioctl handler. */
-static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
+static int sctp_ioctl(struct sock *sk, int cmd, int *karg)
 {
        int rc = -ENOTCONN;
 
@@ -4911,7 +4911,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
        switch (cmd) {
        case SIOCINQ: {
                struct sk_buff *skb;
-               unsigned int amount = 0;
+               *karg = 0;
 
                skb = skb_peek(&sk->sk_receive_queue);
                if (skb != NULL) {
@@ -4919,9 +4919,9 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg)
                         * We will only return the amount of this packet since
                         * that is all that will be read.
                         */
-                       amount = skb->len;
+                       *karg = skb->len;
                }
-               rc = put_user(amount, (int __user *)arg);
+               rc = 0;
                break;
        }
        default:
@@ -8281,6 +8281,22 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname,
        return retval;
 }
 
+static bool sctp_bpf_bypass_getsockopt(int level, int optname)
+{
+       if (level == SOL_SCTP) {
+               switch (optname) {
+               case SCTP_SOCKOPT_PEELOFF:
+               case SCTP_SOCKOPT_PEELOFF_FLAGS:
+               case SCTP_SOCKOPT_CONNECTX3:
+                       return true;
+               default:
+                       return false;
+               }
+       }
+
+       return false;
+}
+
 static int sctp_hash(struct sock *sk)
 {
        /* STUB */
@@ -9650,6 +9666,7 @@ struct proto sctp_prot = {
        .shutdown    =  sctp_shutdown,
        .setsockopt  =  sctp_setsockopt,
        .getsockopt  =  sctp_getsockopt,
+       .bpf_bypass_getsockopt  = sctp_bpf_bypass_getsockopt,
        .sendmsg     =  sctp_sendmsg,
        .recvmsg     =  sctp_recvmsg,
        .bind        =  sctp_bind,
@@ -9705,6 +9722,7 @@ struct proto sctpv6_prot = {
        .shutdown       = sctp_shutdown,
        .setsockopt     = sctp_setsockopt,
        .getsockopt     = sctp_getsockopt,
+       .bpf_bypass_getsockopt  = sctp_bpf_bypass_getsockopt,
        .sendmsg        = sctp_sendmsg,
        .recvmsg        = sctp_recvmsg,
        .bind           = sctp_bind,