net: sctp: sctp_ssnmap: remove 'malloced' element from struct
sctp_ssnmap_init() can only be called from sctp_ssnmap_new() where malloced is always set to 1. Thus, when we call sctp_ssnmap_free() the test for map->malloced evaluates always to true. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
92cf1f23cc
commit
542c2d8320
2 changed files with 11 additions and 11 deletions
|
@ -399,7 +399,6 @@ struct sctp_stream {
|
||||||
struct sctp_ssnmap {
|
struct sctp_ssnmap {
|
||||||
struct sctp_stream in;
|
struct sctp_stream in;
|
||||||
struct sctp_stream out;
|
struct sctp_stream out;
|
||||||
int malloced;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
|
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
|
||||||
|
|
|
@ -74,7 +74,6 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out,
|
||||||
if (!sctp_ssnmap_init(retval, in, out))
|
if (!sctp_ssnmap_init(retval, in, out))
|
||||||
goto fail_map;
|
goto fail_map;
|
||||||
|
|
||||||
retval->malloced = 1;
|
|
||||||
SCTP_DBG_OBJCNT_INC(ssnmap);
|
SCTP_DBG_OBJCNT_INC(ssnmap);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -118,14 +117,16 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
|
||||||
/* Dispose of a ssnmap. */
|
/* Dispose of a ssnmap. */
|
||||||
void sctp_ssnmap_free(struct sctp_ssnmap *map)
|
void sctp_ssnmap_free(struct sctp_ssnmap *map)
|
||||||
{
|
{
|
||||||
if (map && map->malloced) {
|
int size;
|
||||||
int size;
|
|
||||||
|
|
||||||
size = sctp_ssnmap_size(map->in.len, map->out.len);
|
if (unlikely(!map))
|
||||||
if (size <= KMALLOC_MAX_SIZE)
|
return;
|
||||||
kfree(map);
|
|
||||||
else
|
size = sctp_ssnmap_size(map->in.len, map->out.len);
|
||||||
free_pages((unsigned long)map, get_order(size));
|
if (size <= KMALLOC_MAX_SIZE)
|
||||||
SCTP_DBG_OBJCNT_DEC(ssnmap);
|
kfree(map);
|
||||||
}
|
else
|
||||||
|
free_pages((unsigned long)map, get_order(size));
|
||||||
|
|
||||||
|
SCTP_DBG_OBJCNT_DEC(ssnmap);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue