sock: struct proto hash function may error
[cascardo/linux.git] / net / ipv6 / af_inet6.c
index 9f5137c..b11c37c 100644 (file)
@@ -235,7 +235,11 @@ lookup_protocol:
                 * creation time automatically shares.
                 */
                inet->inet_sport = htons(inet->inet_num);
-               sk->sk_prot->hash(sk);
+               err = sk->sk_prot->hash(sk);
+               if (err) {
+                       sk_common_release(sk);
+                       goto out;
+               }
        }
        if (sk->sk_prot->init) {
                err = sk->sk_prot->init(sk);