Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ff4680e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [PKT_SCHED] sch_htb: use rb_first() cleanup
  [RTNETLINK]: Fix use of wrong skb in do_getlink()
  [DECNET]: Fix sfuzz hanging on 2.6.18
  [NET]: Do not memcmp() over pad bytes of struct flowi.
  [NET]: Introduce protocol-specific destructor for time-wait sockets.
  [NET]: Use typesafe inet_twsk() inline function instead of cast.
  [NET]: Use hton{l,s}() for non-initializers.
  [TCP]: Use TCPOLEN_TSTAMP_ALIGNED macro instead of magic number.
  [IPV6]: Seperate sit driver to extra module (addrconf.c changes)
  [IPV6]: Seperate sit driver to extra module
  [NET]: File descriptor loss while receiving SCM_RIGHTS
  [SCTP]: Fix the RX queue size shown in /proc/net/sctp/assocs output.
  [SCTP]: Fix receive buffer accounting.
  SELinux: Bug fix in polidydb_destroy
  IPsec: fix handling of errors for socket policies
  IPsec: correct semantics for SELinux policy matching
  IPsec: propagate security module errors up from flow_cache_lookup
  NetLabel: use SECINITSID_UNLABELED for a base SID
  NetLabel: fix a cache race condition
parents 83d3d3c5 30bdbe39
Loading
Loading
Loading
Loading
+9 −15
Original line number Original line Diff line number Diff line
@@ -882,7 +882,8 @@ struct request_sock;
 *	Check permission when a flow selects a xfrm_policy for processing
 *	Check permission when a flow selects a xfrm_policy for processing
 *	XFRMs on a packet.  The hook is called when selecting either a
 *	XFRMs on a packet.  The hook is called when selecting either a
 *	per-socket policy or a generic xfrm policy.
 *	per-socket policy or a generic xfrm policy.
 *	Return 0 if permission is granted.
 *	Return 0 if permission is granted, -ESRCH otherwise, or -errno
 *	on other errors.
 * @xfrm_state_pol_flow_match:
 * @xfrm_state_pol_flow_match:
 *	@x contains the state to match.
 *	@x contains the state to match.
 *	@xp contains the policy to check for a match.
 *	@xp contains the policy to check for a match.
@@ -891,6 +892,7 @@ struct request_sock;
 * @xfrm_flow_state_match:
 * @xfrm_flow_state_match:
 *	@fl contains the flow key to match.
 *	@fl contains the flow key to match.
 *	@xfrm points to the xfrm_state to match.
 *	@xfrm points to the xfrm_state to match.
 *	@xp points to the xfrm_policy to match.
 *	Return 1 if there is a match.
 *	Return 1 if there is a match.
 * @xfrm_decode_session:
 * @xfrm_decode_session:
 *	@skb points to skb to decode.
 *	@skb points to skb to decode.
@@ -1388,7 +1390,8 @@ struct security_operations {
	int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
	int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
	int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
	int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
			struct xfrm_policy *xp, struct flowi *fl);
			struct xfrm_policy *xp, struct flowi *fl);
	int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm);
	int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm,
			struct xfrm_policy *xp);
	int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
	int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
#endif	/* CONFIG_SECURITY_NETWORK_XFRM */
#endif	/* CONFIG_SECURITY_NETWORK_XFRM */


@@ -3120,11 +3123,6 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
	return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
	return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL);
}
}


static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
{
	return security_ops->xfrm_policy_alloc_security(xp, NULL, sk);
}

static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
{
{
	return security_ops->xfrm_policy_clone_security(old, new);
	return security_ops->xfrm_policy_clone_security(old, new);
@@ -3175,9 +3173,10 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
	return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
	return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
}
}


static inline int security_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm)
static inline int security_xfrm_flow_state_match(struct flowi *fl,
			struct xfrm_state *xfrm, struct xfrm_policy *xp)
{
{
	return security_ops->xfrm_flow_state_match(fl, xfrm);
	return security_ops->xfrm_flow_state_match(fl, xfrm, xp);
}
}


static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
@@ -3197,11 +3196,6 @@ static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm
	return 0;
	return 0;
}
}


static inline int security_xfrm_sock_policy_alloc(struct xfrm_policy *xp, struct sock *sk)
{
	return 0;
}

static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
{
{
	return 0;
	return 0;
@@ -3249,7 +3243,7 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
}
}


static inline int security_xfrm_flow_state_match(struct flowi *fl,
static inline int security_xfrm_flow_state_match(struct flowi *fl,
                                struct xfrm_state *xfrm)
			struct xfrm_state *xfrm, struct xfrm_policy *xp)
{
{
	return 1;
	return 1;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -97,7 +97,7 @@ struct flowi {
#define FLOW_DIR_FWD	2
#define FLOW_DIR_FWD	2


struct sock;
struct sock;
typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir,
typedef int (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir,
			       void **objp, atomic_t **obj_refp);
			       void **objp, atomic_t **obj_refp);


extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
+1 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw)
{
{
	if (atomic_dec_and_test(&tw->tw_refcnt)) {
	if (atomic_dec_and_test(&tw->tw_refcnt)) {
		struct module *owner = tw->tw_prot->owner;
		struct module *owner = tw->tw_prot->owner;
		twsk_destructor((struct sock *)tw);
#ifdef SOCK_REFCNT_DEBUG
#ifdef SOCK_REFCNT_DEBUG
		printk(KERN_DEBUG "%s timewait_sock %p released\n",
		printk(KERN_DEBUG "%s timewait_sock %p released\n",
		       tw->tw_prot->name, tw);
		       tw->tw_prot->name, tw);
+47 −15
Original line number Original line Diff line number Diff line
@@ -34,6 +34,7 @@
#include <linux/net.h>
#include <linux/net.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <net/netlink.h>
#include <net/netlink.h>
#include <asm/atomic.h>


/*
/*
 * NetLabel - A management interface for maintaining network packet label
 * NetLabel - A management interface for maintaining network packet label
@@ -106,6 +107,7 @@ int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info);


/* LSM security attributes */
/* LSM security attributes */
struct netlbl_lsm_cache {
struct netlbl_lsm_cache {
	atomic_t refcount;
	void (*free) (const void *data);
	void (*free) (const void *data);
	void *data;
	void *data;
};
};
@@ -117,7 +119,7 @@ struct netlbl_lsm_secattr {
	unsigned char *mls_cat;
	unsigned char *mls_cat;
	size_t mls_cat_len;
	size_t mls_cat_len;


	struct netlbl_lsm_cache cache;
	struct netlbl_lsm_cache *cache;
};
};


/*
/*
@@ -125,6 +127,43 @@ struct netlbl_lsm_secattr {
 */
 */




/**
 * netlbl_secattr_cache_alloc - Allocate and initialize a secattr cache
 * @flags: the memory allocation flags
 *
 * Description:
 * Allocate and initialize a netlbl_lsm_cache structure.  Returns a pointer
 * on success, NULL on failure.
 *
 */
static inline struct netlbl_lsm_cache *netlbl_secattr_cache_alloc(int flags)
{
	struct netlbl_lsm_cache *cache;

	cache = kzalloc(sizeof(*cache), flags);
	if (cache)
		atomic_set(&cache->refcount, 1);
	return cache;
}

/**
 * netlbl_secattr_cache_free - Frees a netlbl_lsm_cache struct
 * @cache: the struct to free
 *
 * Description:
 * Frees @secattr including all of the internal buffers.
 *
 */
static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
{
	if (!atomic_dec_and_test(&cache->refcount))
		return;

	if (cache->free)
		cache->free(cache->data);
	kfree(cache);
}

/**
/**
 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
 * @secattr: the struct to initialize
 * @secattr: the struct to initialize
@@ -143,20 +182,16 @@ static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
/**
/**
 * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct
 * netlbl_secattr_destroy - Clears a netlbl_lsm_secattr struct
 * @secattr: the struct to clear
 * @secattr: the struct to clear
 * @clear_cache: cache clear flag
 *
 *
 * Description:
 * Description:
 * Destroys the @secattr struct, including freeing all of the internal buffers.
 * Destroys the @secattr struct, including freeing all of the internal buffers.
 * If @clear_cache is true then free the cache fields, otherwise leave them
 * The struct must be reset with a call to netlbl_secattr_init() before reuse.
 * intact.  The struct must be reset with a call to netlbl_secattr_init()
 * before reuse.
 *
 *
 */
 */
static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr,
static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
					  u32 clear_cache)
{
{
	if (clear_cache && secattr->cache.data != NULL && secattr->cache.free)
	if (secattr->cache)
		secattr->cache.free(secattr->cache.data);
		netlbl_secattr_cache_free(secattr->cache);
	kfree(secattr->domain);
	kfree(secattr->domain);
	kfree(secattr->mls_cat);
	kfree(secattr->mls_cat);
}
}
@@ -178,17 +213,14 @@ static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags)
/**
/**
 * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct
 * netlbl_secattr_free - Frees a netlbl_lsm_secattr struct
 * @secattr: the struct to free
 * @secattr: the struct to free
 * @clear_cache: cache clear flag
 *
 *
 * Description:
 * Description:
 * Frees @secattr including all of the internal buffers.  If @clear_cache is
 * Frees @secattr including all of the internal buffers.
 * true then free the cache fields, otherwise leave them intact.
 *
 *
 */
 */
static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr,
static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
				       u32 clear_cache)
{
{
	netlbl_secattr_destroy(secattr, clear_cache);
	netlbl_secattr_destroy(secattr);
	kfree(secattr);
	kfree(secattr);
}
}


+14 −0
Original line number Original line Diff line number Diff line
@@ -139,6 +139,7 @@ int sctp_inet_listen(struct socket *sock, int backlog);
void sctp_write_space(struct sock *sk);
void sctp_write_space(struct sock *sk);
unsigned int sctp_poll(struct file *file, struct socket *sock,
unsigned int sctp_poll(struct file *file, struct socket *sock,
		poll_table *wait);
		poll_table *wait);
void sctp_sock_rfree(struct sk_buff *skb);


/*
/*
 * sctp/primitive.c
 * sctp/primitive.c
@@ -444,6 +445,19 @@ static inline struct list_head *sctp_list_dequeue(struct list_head *list)
	return result;
	return result;
}
}


/* SCTP version of skb_set_owner_r.  We need this one because
 * of the way we have to do receive buffer accounting on bundled
 * chunks.
 */
static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
{
	struct sctp_ulpevent *event = sctp_skb2event(skb);

	skb->sk = sk;
	skb->destructor = sctp_sock_rfree;
	atomic_add(event->rmem_len, &sk->sk_rmem_alloc);
}

/* Tests if the list has one and only one entry. */
/* Tests if the list has one and only one entry. */
static inline int sctp_list_single_entry(struct list_head *head)
static inline int sctp_list_single_entry(struct list_head *head)
{
{
Loading