From: Vlad Yasevich Date: Wed, 9 May 2007 20:50:20 +0000 (-0700) Subject: [SCTP]: Prevent OOPS if hmac modules didn't load X-Git-Tag: v2.6.22-rc1~34^2~20 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=8dc4984a6bdcaf56cdb458a7338c32c16f32540c;p=~emulex%2Finfiniband.git [SCTP]: Prevent OOPS if hmac modules didn't load 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 Signed-off-by: David S. Miller --- diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 83a76ba9d7b..f3c95f9bd41 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -5227,7 +5227,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; }