diff options
| author | Sridhar Samudrala <sri@us.ibm.com> | 2004-04-05 17:32:30 -0700 |
|---|---|---|
| committer | Sridhar Samudrala <sri@us.ibm.com> | 2004-04-05 17:32:30 -0700 |
| commit | 321fe6f8b00db387f7e05ed5be8d21fff028dbbb (patch) | |
| tree | 6516e7bf7d9348805c9390829c35a7550258d1fc /include | |
| parent | 8843177d413b1c59c57e78a6a55ea3099aca48ca (diff) | |
[SCTP] Use id to ptr translation service in lib/idr.c to assign and
validate ids of associations.
This patch avoids the use of virt_addr_valid() to validate the address
of associations passed by the user. Currently the address of an
association is used as its id. virt_addr_valid doesn't work as
expected when PAGEALLOC debugging is enabled.
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/sctp/sctp.h | 26 | ||||
| -rw-r--r-- | include/net/sctp/structs.h | 9 |
2 files changed, 9 insertions, 26 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 3fa80e611ba1..6a6c6641e446 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -1,5 +1,5 @@ /* SCTP kernel reference Implementation - * (C) Copyright IBM Corp. 2001, 2003 + * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001-2003 Intel Corp. @@ -78,6 +78,7 @@ #include <linux/proc_fs.h> #include <linux/spinlock.h> #include <linux/jiffies.h> +#include <linux/idr.h> #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #include <net/ipv6.h> @@ -223,24 +224,6 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); #define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) #define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field) -/* Determine if this is a valid kernel address. */ -static inline int sctp_is_valid_kaddr(unsigned long addr) -{ - struct page *page; - - /* Make sure the address is not in the user address space. */ - if (addr < PAGE_OFFSET) - return 0; - - page = virt_to_page(addr); - - /* Is this page valid? */ - if (!virt_addr_valid(addr) || PageReserved(page)) - return 0; - - return 1; -} - #endif /* !TEST_FRAME */ @@ -357,7 +340,7 @@ static inline void sctp_v6_exit(void) { return; } /* Map an association to an assoc_id. */ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) { - return (sctp_assoc_t) asoc; + return (asoc?asoc->assoc_id:NULL); } /* Look up the association by its id. */ @@ -519,6 +502,9 @@ extern struct proto sctp_prot; extern struct proc_dir_entry *proc_net_sctp; void sctp_put_port(struct sock *sk); +extern struct idr sctp_assocs_id; +extern spinlock_t sctp_assocs_id_lock; + /* Static inline functions. */ /* Convert from an IP version number to an Address Family symbol. */ diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index a36880e6733f..a9f8c029361e 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1,5 +1,5 @@ /* SCTP kernel reference Implementation - * (C) Copyright IBM Corp. 2001, 2003 + * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001 Intel Corp. @@ -1282,11 +1282,8 @@ struct sctp_association { /* Associations on the same socket. */ struct list_head asocs; - /* This is a signature that lets us know that this is a - * struct sctp_association data structure. Used for mapping an - * association id to an association. - */ - __u32 eyecatcher; + /* association id. */ + sctp_assoc_t assoc_id; /* This is our parent endpoint. */ struct sctp_endpoint *ep; |
