]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - crypto/af_alg.c
crypto: af_alg - fix possible uninit-value in alg_bind()
[linux.git] / crypto / af_alg.c
index 0f8d8d5523c317f954fd4de62299961fed4bb141..7846c0c20cfec1998674e18e0a516a89caea509f 100644 (file)
@@ -158,16 +158,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
        void *private;
        int err;
 
-       /* If caller uses non-allowed flag, return error. */
-       if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
-               return -EINVAL;
-
        if (sock->state == SS_CONNECTED)
                return -EINVAL;
 
        if (addr_len < sizeof(*sa))
                return -EINVAL;
 
+       /* If caller uses non-allowed flag, return error. */
+       if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
+               return -EINVAL;
+
        sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
        sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
 
@@ -735,9 +735,9 @@ void af_alg_wmem_wakeup(struct sock *sk)
        rcu_read_lock();
        wq = rcu_dereference(sk->sk_wq);
        if (skwq_has_sleeper(wq))
-               wake_up_interruptible_sync_poll(&wq->wait, POLLIN |
-                                                          POLLRDNORM |
-                                                          POLLRDBAND);
+               wake_up_interruptible_sync_poll(&wq->wait, EPOLLIN |
+                                                          EPOLLRDNORM |
+                                                          EPOLLRDBAND);
        sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
        rcu_read_unlock();
 }
@@ -800,9 +800,9 @@ void af_alg_data_wakeup(struct sock *sk)
        rcu_read_lock();
        wq = rcu_dereference(sk->sk_wq);
        if (skwq_has_sleeper(wq))
-               wake_up_interruptible_sync_poll(&wq->wait, POLLOUT |
-                                                          POLLRDNORM |
-                                                          POLLRDBAND);
+               wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
+                                                          EPOLLRDNORM |
+                                                          EPOLLRDBAND);
        sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
        rcu_read_unlock();
 }
@@ -1076,10 +1076,10 @@ __poll_t af_alg_poll(struct file *file, struct socket *sock,
        mask = 0;
 
        if (!ctx->more || ctx->used)
-               mask |= POLLIN | POLLRDNORM;
+               mask |= EPOLLIN | EPOLLRDNORM;
 
        if (af_alg_writable(sk))
-               mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
+               mask |= EPOLLOUT | EPOLLWRNORM | EPOLLWRBAND;
 
        return mask;
 }