mirror of https://gitee.com/openkylin/linux.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 <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d9568ba91b
commit
8dc4984a6b
|
@ -5227,7 +5227,12 @@ int sctp_inet_listen(struct socket *sock, int backlog)
|
||||||
/* Allocate HMAC for generating cookie. */
|
/* Allocate HMAC for generating cookie. */
|
||||||
if (sctp_hmac_alg) {
|
if (sctp_hmac_alg) {
|
||||||
tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC);
|
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;
|
err = -ENOSYS;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue