Commit 03e92484 authored by David S. Miller's avatar David S. Miller

Merge http://linux-lksctp.bkbits.net/lksctp-2.5.work

into nuts.davemloft.net:/disk1/BK/net-2.6
parents bd86acf1 a1ec4338
...@@ -74,13 +74,19 @@ config SCTP_HMAC_NONE ...@@ -74,13 +74,19 @@ config SCTP_HMAC_NONE
establishment. It is advised to use either HMAC-MD5 or HMAC-SHA1. establishment. It is advised to use either HMAC-MD5 or HMAC-SHA1.
config SCTP_HMAC_SHA1 config SCTP_HMAC_SHA1
bool "HMAC-SHA1" if CRYPTO_HMAC=y && CRYPTO_SHA1=y || CRYPTO_SHA1=m bool "HMAC-SHA1"
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_SHA1
help help
Enable the use of HMAC-SHA1 during association establishment. It Enable the use of HMAC-SHA1 during association establishment. It
is advised to use either HMAC-MD5 or HMAC-SHA1. is advised to use either HMAC-MD5 or HMAC-SHA1.
config SCTP_HMAC_MD5 config SCTP_HMAC_MD5
bool "HMAC-MD5" if CRYPTO_HMAC=y && CRYPTO_MD5=y || CRYPTO_MD5=m bool "HMAC-MD5"
select CRYPTO
select CRYPTO_HMAC
select CRYPTO_MD5
help help
Enable the use of HMAC-MD5 during association establishment. It is Enable the use of HMAC-MD5 during association establishment. It is
advised to use either HMAC-MD5 or HMAC-SHA1. advised to use either HMAC-MD5 or HMAC-SHA1.
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <net/sctp/sctp.h> #include <net/sctp/sctp.h>
#include <net/sctp/sm.h> #include <net/sctp/sm.h>
#define MAX_KMALLOC_SIZE 131072
/* Storage size needed for map includes 2 headers and then the /* Storage size needed for map includes 2 headers and then the
* specific needs of in or out streams. * specific needs of in or out streams.
...@@ -56,11 +57,14 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out) ...@@ -56,11 +57,14 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
{ {
struct sctp_ssnmap *retval; struct sctp_ssnmap *retval;
int order; int size;
order = get_order(sctp_ssnmap_size(in,out)); size = sctp_ssnmap_size(in, out);
retval = (struct sctp_ssnmap *)__get_free_pages(gfp, order); if (size <= MAX_KMALLOC_SIZE)
retval = kmalloc(size, gfp);
else
retval = (struct sctp_ssnmap *)
__get_free_pages(gfp, get_order(size));
if (!retval) if (!retval)
goto fail; goto fail;
...@@ -73,7 +77,10 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) ...@@ -73,7 +77,10 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
return retval; return retval;
fail_map: fail_map:
free_pages((unsigned long)retval, order); if (size <= MAX_KMALLOC_SIZE)
kfree(retval);
else
free_pages((unsigned long)retval, get_order(size));
fail: fail:
return NULL; return NULL;
} }
...@@ -109,9 +116,13 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map) ...@@ -109,9 +116,13 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
void sctp_ssnmap_free(struct sctp_ssnmap *map) void sctp_ssnmap_free(struct sctp_ssnmap *map)
{ {
if (map && map->malloced) { if (map && map->malloced) {
free_pages((unsigned long)map, int size;
get_order(sctp_ssnmap_size(map->in.len,
map->out.len))); size = sctp_ssnmap_size(map->in.len, map->out.len);
if (size <= MAX_KMALLOC_SIZE)
kfree(map);
else
free_pages((unsigned long)map, get_order(size));
SCTP_DBG_OBJCNT_DEC(ssnmap); SCTP_DBG_OBJCNT_DEC(ssnmap);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment