Skip to content

Commit

Permalink
[SCTP]: Prevent OOPS if hmac modules didn't load
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed May 11, 2007
1 parent d9568ba commit 8dc4984
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8dc4984

Please sign in to comment.