diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-05-09 16:50:20 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-11 02:45:29 -0400 |
commit | 8dc4984a6bdcaf56cdb458a7338c32c16f32540c (patch) | |
tree | 565bd6c7090ac424fc4239537f03bc6ba86ea99b /net/sctp/socket.c | |
parent | d9568ba91b1fdd1ea4fdbf9fcc76b867cca6c1d5 (diff) |
[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 <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 83a76ba9d7b3..f3c95f9bd413 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5227,7 +5227,12 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
5227 | /* Allocate HMAC for generating cookie. */ | 5227 | /* Allocate HMAC for generating cookie. */ |
5228 | if (sctp_hmac_alg) { | 5228 | if (sctp_hmac_alg) { |
5229 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); | 5229 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); |
5230 | if (!tfm) { | 5230 | if (IS_ERR(tfm)) { |
5231 | if (net_ratelimit()) { | ||
5232 | printk(KERN_INFO | ||
5233 | "SCTP: failed to load transform for %s: %ld\n", | ||
5234 | sctp_hmac_alg, PTR_ERR(tfm)); | ||
5235 | } | ||
5231 | err = -ENOSYS; | 5236 | err = -ENOSYS; |
5232 | goto out; | 5237 | goto out; |
5233 | } | 5238 | } |