]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - net/ax25/af_ax25.c
net: pass kern to net_proto_family create function
[mirror_ubuntu-eoan-kernel.git] / net / ax25 / af_ax25.c
index 4102de1022eece06825ea8fa70e101b006f6e67c..d6ddfa4c4471fad58183e520c7e05b1c5ec69081 100644 (file)
@@ -369,6 +369,9 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
        if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
                return -EINVAL;
 
+       if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
+               return -EINVAL;
+
        digi.ndigi = ax25_ctl.digi_count;
        for (k = 0; k < digi.ndigi; k++)
                digi.calls[k] = ax25_ctl.digi_addr[k];
@@ -418,14 +421,10 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
                break;
 
        case AX25_T3:
-               if (ax25_ctl.arg < 0)
-                       goto einval_put;
                ax25->t3 = ax25_ctl.arg * HZ;
                break;
 
        case AX25_IDLE:
-               if (ax25_ctl.arg < 0)
-                       goto einval_put;
                ax25->idle = ax25_ctl.arg * 60 * HZ;
                break;
 
@@ -534,7 +533,7 @@ ax25_cb *ax25_create_cb(void)
  */
 
 static int ax25_setsockopt(struct socket *sock, int level, int optname,
-       char __user *optval, int optlen)
+       char __user *optval, unsigned int optlen)
 {
        struct sock *sk = sock->sk;
        ax25_cb *ax25;
@@ -800,7 +799,8 @@ static struct proto ax25_proto = {
        .obj_size = sizeof(struct sock),
 };
 
-static int ax25_create(struct net *net, struct socket *sock, int protocol)
+static int ax25_create(struct net *net, struct socket *sock, int protocol,
+                      int kern)
 {
        struct sock *sk;
        ax25_cb *ax25;
@@ -901,7 +901,6 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
 
        sock_init_data(NULL, sk);
 
-       sk->sk_destruct = ax25_free_sock;
        sk->sk_type     = osk->sk_type;
        sk->sk_priority = osk->sk_priority;
        sk->sk_protocol = osk->sk_protocol;
@@ -939,6 +938,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
        }
 
        sk->sk_protinfo = ax25;
+       sk->sk_destruct = ax25_free_sock;
        ax25->sk    = sk;
 
        return sk;
@@ -1961,7 +1961,7 @@ static const struct file_operations ax25_info_fops = {
 
 #endif
 
-static struct net_proto_family ax25_family_ops = {
+static const struct net_proto_family ax25_family_ops = {
        .family =       PF_AX25,
        .create =       ax25_create,
        .owner  =       THIS_MODULE,