]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] SCTP: Prevent OOPS if hmac modules didn't load
authorVlad Yasevich <vladislav.yasevich@hp.com>
Tue, 15 May 2007 08:32:35 +0000 (01:32 -0700)
committerChris Wright <chrisw@sous-sol.org>
Wed, 23 May 2007 21:32:51 +0000 (14:32 -0700)
SCTP was checking for NULL when trying to detect hmac
allocation failure where it should have been using IS_ERR.
Also, print a rate limited warning to the log telling the
user what happend.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
net/sctp/socket.c

index ffaac2043f0131dcf0380d4eec44950d3136a41d..843c928b50c36625e1bab755406b284229d12188 100644 (file)
@@ -4989,7 +4989,12 @@ int sctp_inet_listen(struct socket *sock, int backlog)
        /* Allocate HMAC for generating cookie. */
        if (sctp_hmac_alg) {
                tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC);
-               if (!tfm) {
+               if (IS_ERR(tfm)) {
+                       if (net_ratelimit()) {
+                               printk(KERN_INFO
+                                      "SCTP: failed to load transform for %s: %ld\n",
+                                       sctp_hmac_alg, PTR_ERR(tfm));
+                       }
                        err = -ENOSYS;
                        goto out;
                }