2007-05-21 19:48:50

by Chris Wright

[permalink] [raw]
Subject: [patch 52/69] SCTP: Prevent OOPS if hmac modules didnt load

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Vlad Yasevich <[email protected]>

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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Chris Wright <[email protected]>

---
net/sctp/socket.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6.21.1.orig/net/sctp/socket.c
+++ linux-2.6.21.1/net/sctp/socket.c
@@ -4985,7 +4985,12 @@ int sctp_inet_listen(struct socket *sock
/* 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;
}

--