diff --git a/[refs] b/[refs] index 657138a45644..016b9999296b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e6a04b1d3ff9d5af219b2fcaebe0ef04733d597c +refs/heads/master: afaa9459de639591ff3318fd215a813c8d794759 diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4326f74f7137..f7351c6fa3b5 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1167,7 +1167,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring, } bi->dma = dma; - bi->page_offset ^= ixgbe_rx_bufsz(rx_ring); + bi->page_offset = 0; return true; } @@ -4129,27 +4129,6 @@ void ixgbe_reset(struct ixgbe_adapter *adapter) hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0)); } -/** - * ixgbe_init_rx_page_offset - initialize page offset values for Rx buffers - * @rx_ring: ring to setup - * - * On many IA platforms the L1 cache has a critical stride of 4K, this - * results in each receive buffer starting in the same cache set. To help - * reduce the pressure on this cache set we can interleave the offsets so - * that only every other buffer will be in the same cache set. - **/ -static void ixgbe_init_rx_page_offset(struct ixgbe_ring *rx_ring) -{ - struct ixgbe_rx_buffer *rx_buffer = rx_ring->rx_buffer_info; - u16 i; - - for (i = 0; i < rx_ring->count; i += 2) { - rx_buffer[0].page_offset = 0; - rx_buffer[1].page_offset = ixgbe_rx_bufsz(rx_ring); - rx_buffer = &rx_buffer[2]; - } -} - /** * ixgbe_clean_rx_ring - Free Rx Buffers per Queue * @rx_ring: ring to free buffers from @@ -4195,8 +4174,6 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring) size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; memset(rx_ring->rx_buffer_info, 0, size); - ixgbe_init_rx_page_offset(rx_ring); - /* Zero out the descriptor ring */ memset(rx_ring->desc, 0, rx_ring->size); @@ -4646,8 +4623,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_ring *rx_ring) rx_ring->next_to_clean = 0; rx_ring->next_to_use = 0; - ixgbe_init_rx_page_offset(rx_ring); - return 0; err: vfree(rx_ring->rx_buffer_info); diff --git a/trunk/include/linux/packet_diag.h b/trunk/include/linux/packet_diag.h index 93f5fa94a431..ea2e8923bd7e 100644 --- a/trunk/include/linux/packet_diag.h +++ b/trunk/include/linux/packet_diag.h @@ -14,8 +14,6 @@ struct packet_diag_req { #define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ -#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ -#define PACKET_SHOW_FANOUT 0x00000008 struct packet_diag_msg { __u8 pdiag_family; @@ -29,9 +27,6 @@ struct packet_diag_msg { enum { PACKET_DIAG_INFO, PACKET_DIAG_MCLIST, - PACKET_DIAG_RX_RING, - PACKET_DIAG_TX_RING, - PACKET_DIAG_FANOUT, PACKET_DIAG_MAX, }; @@ -59,14 +54,4 @@ struct packet_diag_mclist { __u8 pdmc_addr[MAX_ADDR_LEN]; }; -struct packet_diag_ring { - __u32 pdr_block_size; - __u32 pdr_block_nr; - __u32 pdr_frame_size; - __u32 pdr_frame_nr; - __u32 pdr_retire_tmo; - __u32 pdr_sizeof_priv; - __u32 pdr_features; -}; - #endif diff --git a/trunk/include/linux/tipc_config.h b/trunk/include/linux/tipc_config.h index 0b1e3f218a36..c98928420100 100644 --- a/trunk/include/linux/tipc_config.h +++ b/trunk/include/linux/tipc_config.h @@ -89,8 +89,8 @@ #define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ -#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */ -#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */ +#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ #define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ @@ -115,8 +115,8 @@ #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ -#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */ -#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */ +#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ #define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ diff --git a/trunk/net/ipv6/ip6_tunnel.c b/trunk/net/ipv6/ip6_tunnel.c index cb7e2ded6f08..33d2a0e6712d 100644 --- a/trunk/net/ipv6/ip6_tunnel.c +++ b/trunk/net/ipv6/ip6_tunnel.c @@ -1312,8 +1312,6 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) } ip6_tnl_parm_from_user(&p1, &p); t = ip6_tnl_locate(net, &p1, 0); - } else { - memset(&p, 0, sizeof(p)); } if (t == NULL) t = netdev_priv(dev); diff --git a/trunk/net/packet/af_packet.c b/trunk/net/packet/af_packet.c index 226b2cdfc339..8a1605ae4029 100644 --- a/trunk/net/packet/af_packet.c +++ b/trunk/net/packet/af_packet.c @@ -207,6 +207,24 @@ static void prb_fill_vlan_info(struct tpacket_kbdq_core *, struct tpacket3_hdr *); static void packet_flush_mclist(struct sock *sk); +#define PACKET_FANOUT_MAX 256 + +struct packet_fanout { +#ifdef CONFIG_NET_NS + struct net *net; +#endif + unsigned int num_members; + u16 id; + u8 type; + u8 defrag; + atomic_t rr_cur; + struct list_head list; + struct sock *arr[PACKET_FANOUT_MAX]; + spinlock_t lock; + atomic_t sk_ref; + struct packet_type prot_hook ____cacheline_aligned_in_smp; +}; + struct packet_skb_cb { unsigned int origlen; union { @@ -1130,8 +1148,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, return po->prot_hook.func(skb, dev, &po->prot_hook, orig_dev); } -DEFINE_MUTEX(fanout_mutex); -EXPORT_SYMBOL_GPL(fanout_mutex); +static DEFINE_MUTEX(fanout_mutex); static LIST_HEAD(fanout_list); static void __fanout_link(struct sock *sk, struct packet_sock *po) @@ -1243,9 +1260,9 @@ static void fanout_release(struct sock *sk) if (!f) return; - mutex_lock(&fanout_mutex); po->fanout = NULL; + mutex_lock(&fanout_mutex); if (atomic_dec_and_test(&f->sk_ref)) { list_del(&f->list); dev_remove_pack(&f->prot_hook); diff --git a/trunk/net/packet/diag.c b/trunk/net/packet/diag.c index bc33fbe8a5ef..3dda4ecb9a46 100644 --- a/trunk/net/packet/diag.c +++ b/trunk/net/packet/diag.c @@ -67,70 +67,12 @@ static int pdiag_put_mclist(const struct packet_sock *po, struct sk_buff *nlskb) return 0; } -static int pdiag_put_ring(struct packet_ring_buffer *ring, int ver, int nl_type, - struct sk_buff *nlskb) -{ - struct packet_diag_ring pdr; - - if (!ring->pg_vec || ((ver > TPACKET_V2) && - (nl_type == PACKET_DIAG_TX_RING))) - return 0; - - pdr.pdr_block_size = ring->pg_vec_pages << PAGE_SHIFT; - pdr.pdr_block_nr = ring->pg_vec_len; - pdr.pdr_frame_size = ring->frame_size; - pdr.pdr_frame_nr = ring->frame_max + 1; - - if (ver > TPACKET_V2) { - pdr.pdr_retire_tmo = ring->prb_bdqc.retire_blk_tov; - pdr.pdr_sizeof_priv = ring->prb_bdqc.blk_sizeof_priv; - pdr.pdr_features = ring->prb_bdqc.feature_req_word; - } else { - pdr.pdr_retire_tmo = 0; - pdr.pdr_sizeof_priv = 0; - pdr.pdr_features = 0; - } - - return nla_put(nlskb, nl_type, sizeof(pdr), &pdr); -} - -static int pdiag_put_rings_cfg(struct packet_sock *po, struct sk_buff *skb) -{ - int ret; - - mutex_lock(&po->pg_vec_lock); - ret = pdiag_put_ring(&po->rx_ring, po->tp_version, - PACKET_DIAG_RX_RING, skb); - if (!ret) - ret = pdiag_put_ring(&po->tx_ring, po->tp_version, - PACKET_DIAG_TX_RING, skb); - mutex_unlock(&po->pg_vec_lock); - - return ret; -} - -static int pdiag_put_fanout(struct packet_sock *po, struct sk_buff *nlskb) -{ - int ret = 0; - - mutex_lock(&fanout_mutex); - if (po->fanout) { - u32 val; - - val = (u32)po->fanout->id | ((u32)po->fanout->type << 16); - ret = nla_put_u32(nlskb, PACKET_DIAG_FANOUT, val); - } - mutex_unlock(&fanout_mutex); - - return ret; -} - static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag_req *req, u32 pid, u32 seq, u32 flags, int sk_ino) { struct nlmsghdr *nlh; struct packet_diag_msg *rp; - struct packet_sock *po = pkt_sk(sk); + const struct packet_sock *po = pkt_sk(sk); nlh = nlmsg_put(skb, pid, seq, SOCK_DIAG_BY_FAMILY, sizeof(*rp), flags); if (!nlh) @@ -151,14 +93,6 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag pdiag_put_mclist(po, skb)) goto out_nlmsg_trim; - if ((req->pdiag_show & PACKET_SHOW_RING_CFG) && - pdiag_put_rings_cfg(po, skb)) - goto out_nlmsg_trim; - - if ((req->pdiag_show & PACKET_SHOW_FANOUT) && - pdiag_put_fanout(po, skb)) - goto out_nlmsg_trim; - return nlmsg_end(skb, nlh); out_nlmsg_trim: diff --git a/trunk/net/packet/internal.h b/trunk/net/packet/internal.h index 44945f6b7252..2c5fca28b242 100644 --- a/trunk/net/packet/internal.h +++ b/trunk/net/packet/internal.h @@ -67,25 +67,7 @@ struct packet_ring_buffer { atomic_t pending; }; -extern struct mutex fanout_mutex; -#define PACKET_FANOUT_MAX 256 - -struct packet_fanout { -#ifdef CONFIG_NET_NS - struct net *net; -#endif - unsigned int num_members; - u16 id; - u8 type; - u8 defrag; - atomic_t rr_cur; - struct list_head list; - struct sock *arr[PACKET_FANOUT_MAX]; - spinlock_t lock; - atomic_t sk_ref; - struct packet_type prot_hook ____cacheline_aligned_in_smp; -}; - +struct packet_fanout; struct packet_sock { /* struct sock has to be the first member of packet_sock */ struct sock sk; diff --git a/trunk/net/tipc/bearer.c b/trunk/net/tipc/bearer.c index 4ec5c80e8a7c..09e71241265d 100644 --- a/trunk/net/tipc/bearer.c +++ b/trunk/net/tipc/bearer.c @@ -48,6 +48,21 @@ struct tipc_bearer tipc_bearers[MAX_BEARERS]; static void bearer_disable(struct tipc_bearer *b_ptr); +/** + * media_name_valid - validate media name + * + * Returns 1 if media name is valid, otherwise 0. + */ +static int media_name_valid(const char *name) +{ + u32 len; + + len = strlen(name); + if ((len + 1) > TIPC_MAX_MEDIA_NAME) + return 0; + return strspn(name, tipc_alphabet) == len; +} + /** * tipc_media_find - locates specified media object by name */ @@ -87,7 +102,7 @@ int tipc_register_media(struct tipc_media *m_ptr) write_lock_bh(&tipc_net_lock); - if ((strlen(m_ptr->name) + 1) > TIPC_MAX_MEDIA_NAME) + if (!media_name_valid(m_ptr->name)) goto exit; if ((m_ptr->bcast_addr.media_id != m_ptr->type_id) || !m_ptr->bcast_addr.broadcast) @@ -191,7 +206,9 @@ static int bearer_name_validate(const char *name, /* validate component parts of bearer name */ if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || - (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME)) + (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || + (strspn(media_name, tipc_alphabet) != (media_len - 1)) || + (strspn(if_name, tipc_alphabet) != (if_len - 1))) return 0; /* return bearer name components, if necessary */ diff --git a/trunk/net/tipc/config.c b/trunk/net/tipc/config.c index f67866c765dd..a056a3852f71 100644 --- a/trunk/net/tipc/config.c +++ b/trunk/net/tipc/config.c @@ -2,7 +2,7 @@ * net/tipc/config.c: TIPC configuration management code * * Copyright (c) 2002-2006, Ericsson AB - * Copyright (c) 2004-2007, 2010-2012, Wind River Systems + * Copyright (c) 2004-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -208,6 +208,36 @@ static struct sk_buff *cfg_set_remote_mng(void) return tipc_cfg_reply_none(); } +static struct sk_buff *cfg_set_max_publications(void) +{ + u32 value; + + if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); + if (value < 1 || value > 65535) + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max publications must be 1-65535)"); + tipc_max_publications = value; + return tipc_cfg_reply_none(); +} + +static struct sk_buff *cfg_set_max_subscriptions(void) +{ + u32 value; + + if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) + return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); + + value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); + if (value < 1 || value > 65535) + return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE + " (max subscriptions must be 1-65535"); + tipc_max_subscriptions = value; + return tipc_cfg_reply_none(); +} + static struct sk_buff *cfg_set_max_ports(void) { u32 value; @@ -327,6 +357,12 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area case TIPC_CMD_SET_MAX_PORTS: rep_tlv_buf = cfg_set_max_ports(); break; + case TIPC_CMD_SET_MAX_PUBL: + rep_tlv_buf = cfg_set_max_publications(); + break; + case TIPC_CMD_SET_MAX_SUBSCR: + rep_tlv_buf = cfg_set_max_subscriptions(); + break; case TIPC_CMD_SET_NETID: rep_tlv_buf = cfg_set_netid(); break; @@ -336,6 +372,12 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area case TIPC_CMD_GET_MAX_PORTS: rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_ports); break; + case TIPC_CMD_GET_MAX_PUBL: + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_publications); + break; + case TIPC_CMD_GET_MAX_SUBSCR: + rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions); + break; case TIPC_CMD_GET_NETID: rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id); break; @@ -351,10 +393,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area case TIPC_CMD_GET_MAX_CLUSTERS: case TIPC_CMD_SET_MAX_NODES: case TIPC_CMD_GET_MAX_NODES: - case TIPC_CMD_SET_MAX_SUBSCR: - case TIPC_CMD_GET_MAX_SUBSCR: - case TIPC_CMD_SET_MAX_PUBL: - case TIPC_CMD_GET_MAX_PUBL: case TIPC_CMD_SET_LOG_SIZE: case TIPC_CMD_DUMP_LOG: rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED diff --git a/trunk/net/tipc/core.c b/trunk/net/tipc/core.c index bfe8af88469a..6586eac6a50e 100644 --- a/trunk/net/tipc/core.c +++ b/trunk/net/tipc/core.c @@ -48,13 +48,18 @@ /* global variables used by multiple sub-systems within TIPC */ -int tipc_random __read_mostly; +int tipc_random; + +const char tipc_alphabet[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; /* configurable TIPC parameters */ -u32 tipc_own_addr __read_mostly; -int tipc_max_ports __read_mostly; -int tipc_net_id __read_mostly; -int tipc_remote_management __read_mostly; +u32 tipc_own_addr; +int tipc_max_ports; +int tipc_max_subscriptions; +int tipc_max_publications; +int tipc_net_id; +int tipc_remote_management; /** @@ -96,8 +101,9 @@ int tipc_core_start_net(unsigned long addr) { int res; - tipc_net_start(addr); - res = tipc_eth_media_start(); + res = tipc_net_start(addr); + if (!res) + res = tipc_eth_media_start(); if (res) tipc_core_stop_net(); return res; @@ -154,6 +160,8 @@ static int __init tipc_init(void) tipc_own_addr = 0; tipc_remote_management = 1; + tipc_max_publications = 10000; + tipc_max_subscriptions = 2000; tipc_max_ports = CONFIG_TIPC_PORTS; tipc_net_id = 4711; diff --git a/trunk/net/tipc/core.h b/trunk/net/tipc/core.h index 0207db04179a..fd42e106c185 100644 --- a/trunk/net/tipc/core.h +++ b/trunk/net/tipc/core.h @@ -60,9 +60,7 @@ #define TIPC_MOD_VER "2.0.0" -#define ULTRA_STRING_MAX_LEN 32768 -#define TIPC_MAX_SUBSCRIPTIONS 65535 -#define TIPC_MAX_PUBLICATIONS 65535 +#define ULTRA_STRING_MAX_LEN 32768 struct tipc_msg; /* msg.h */ @@ -76,15 +74,19 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...); /* * Global configuration variables */ -extern u32 tipc_own_addr __read_mostly; -extern int tipc_max_ports __read_mostly; -extern int tipc_net_id __read_mostly; -extern int tipc_remote_management __read_mostly; +extern u32 tipc_own_addr; +extern int tipc_max_ports; +extern int tipc_max_subscriptions; +extern int tipc_max_publications; +extern int tipc_net_id; +extern int tipc_remote_management; /* * Other global variables */ -extern int tipc_random __read_mostly; +extern int tipc_random; +extern const char tipc_alphabet[]; + /* * Routines available to privileged subsystems diff --git a/trunk/net/tipc/eth_media.c b/trunk/net/tipc/eth_media.c index 2132c1ef2951..90ac9bfa7abb 100644 --- a/trunk/net/tipc/eth_media.c +++ b/trunk/net/tipc/eth_media.c @@ -46,30 +46,19 @@ * @bearer: ptr to associated "generic" bearer structure * @dev: ptr to associated Ethernet network device * @tipc_packet_type: used in binding TIPC to Ethernet driver - * @setup: work item used when enabling bearer * @cleanup: work item used when disabling bearer */ struct eth_bearer { struct tipc_bearer *bearer; struct net_device *dev; struct packet_type tipc_packet_type; - struct work_struct setup; struct work_struct cleanup; }; static struct tipc_media eth_media_info; static struct eth_bearer eth_bearers[MAX_ETH_BEARERS]; static int eth_started; - -static int recv_notification(struct notifier_block *nb, unsigned long evt, - void *dv); -/* - * Network device notifier info - */ -static struct notifier_block notifier = { - .notifier_call = recv_notification, - .priority = 0 -}; +static struct notifier_block notifier; /** * eth_media_addr_set - initialize Ethernet media address structure @@ -144,17 +133,6 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, return 0; } -/** - * setup_bearer - setup association between Ethernet bearer and interface - */ -static void setup_bearer(struct work_struct *work) -{ - struct eth_bearer *eb_ptr = - container_of(work, struct eth_bearer, setup); - - dev_add_pack(&eb_ptr->tipc_packet_type); -} - /** * enable_bearer - attach TIPC bearer to an Ethernet interface */ @@ -195,8 +173,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) eb_ptr->tipc_packet_type.func = recv_msg; eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr; INIT_LIST_HEAD(&(eb_ptr->tipc_packet_type.list)); - INIT_WORK(&eb_ptr->setup, setup_bearer); - schedule_work(&eb_ptr->setup); + dev_add_pack(&eb_ptr->tipc_packet_type); /* Associate TIPC bearer with Ethernet bearer */ eb_ptr->bearer = tb_ptr; @@ -380,6 +357,8 @@ int tipc_eth_media_start(void) if (res) return res; + notifier.notifier_call = &recv_notification; + notifier.priority = 0; res = register_netdevice_notifier(¬ifier); if (!res) eth_started = 1; diff --git a/trunk/net/tipc/handler.c b/trunk/net/tipc/handler.c index 111ff8300ae5..7a52d3922f3c 100644 --- a/trunk/net/tipc/handler.c +++ b/trunk/net/tipc/handler.c @@ -45,7 +45,7 @@ struct queue_item { static struct kmem_cache *tipc_queue_item_cache; static struct list_head signal_queue_head; static DEFINE_SPINLOCK(qitem_lock); -static int handler_enabled __read_mostly; +static int handler_enabled; static void process_signal_queue(unsigned long dummy); diff --git a/trunk/net/tipc/link.c b/trunk/net/tipc/link.c index a79c755cb417..1c1e6151875e 100644 --- a/trunk/net/tipc/link.c +++ b/trunk/net/tipc/link.c @@ -210,7 +210,9 @@ static int link_name_validate(const char *name, (z_local > 255) || (c_local > 4095) || (n_local > 4095) || (z_peer > 255) || (c_peer > 4095) || (n_peer > 4095) || (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || - (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME)) + (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || + (strspn(if_local, tipc_alphabet) != (if_local_len - 1)) || + (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1))) return 0; /* return link name components, if necessary */ diff --git a/trunk/net/tipc/name_table.c b/trunk/net/tipc/name_table.c index 98975e80bb51..360c478b0b53 100644 --- a/trunk/net/tipc/name_table.c +++ b/trunk/net/tipc/name_table.c @@ -41,7 +41,7 @@ #include "subscr.h" #include "port.h" -#define TIPC_NAMETBL_SIZE 1024 /* must be a power of 2 */ +static int tipc_nametbl_size = 1024; /* must be a power of 2 */ /** * struct name_info - name sequence publication info @@ -114,7 +114,7 @@ DEFINE_RWLOCK(tipc_nametbl_lock); static int hash(int x) { - return x & (TIPC_NAMETBL_SIZE - 1); + return x & (tipc_nametbl_size - 1); } /** @@ -667,9 +667,9 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, { struct publication *publ; - if (table.local_publ_count >= TIPC_MAX_PUBLICATIONS) { + if (table.local_publ_count >= tipc_max_publications) { pr_warn("Publication failed, local publication limit reached (%u)\n", - TIPC_MAX_PUBLICATIONS); + tipc_max_publications); return NULL; } @@ -871,7 +871,7 @@ static int nametbl_list(char *buf, int len, u32 depth_info, ret += nametbl_header(buf, len, depth); lowbound = 0; upbound = ~0; - for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { + for (i = 0; i < tipc_nametbl_size; i++) { seq_head = &table.types[i]; hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { ret += nameseq_list(seq, buf + ret, len - ret, @@ -935,7 +935,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) int tipc_nametbl_init(void) { - table.types = kcalloc(TIPC_NAMETBL_SIZE, sizeof(struct hlist_head), + table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head), GFP_ATOMIC); if (!table.types) return -ENOMEM; @@ -953,7 +953,7 @@ void tipc_nametbl_stop(void) /* Verify name table is empty, then release it */ write_lock_bh(&tipc_nametbl_lock); - for (i = 0; i < TIPC_NAMETBL_SIZE; i++) { + for (i = 0; i < tipc_nametbl_size; i++) { if (hlist_empty(&table.types[i])) continue; pr_err("nametbl_stop(): orphaned hash chain detected\n"); diff --git a/trunk/net/tipc/net.c b/trunk/net/tipc/net.c index 7d305ecc09c2..5b5cea259caf 100644 --- a/trunk/net/tipc/net.c +++ b/trunk/net/tipc/net.c @@ -171,7 +171,7 @@ void tipc_net_route_msg(struct sk_buff *buf) tipc_link_send(buf, dnode, msg_link_selector(msg)); } -void tipc_net_start(u32 addr) +int tipc_net_start(u32 addr) { char addr_string[16]; @@ -187,6 +187,7 @@ void tipc_net_start(u32 addr) pr_info("Started in network mode\n"); pr_info("Own node address %s, network identity %u\n", tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); + return 0; } void tipc_net_stop(void) diff --git a/trunk/net/tipc/net.h b/trunk/net/tipc/net.h index 079daadb3f72..9eb4b9e220eb 100644 --- a/trunk/net/tipc/net.h +++ b/trunk/net/tipc/net.h @@ -41,7 +41,7 @@ extern rwlock_t tipc_net_lock; void tipc_net_route_msg(struct sk_buff *buf); -void tipc_net_start(u32 addr); +int tipc_net_start(u32 addr); void tipc_net_stop(void); #endif diff --git a/trunk/net/tipc/subscr.c b/trunk/net/tipc/subscr.c index 0f7d0d007e22..5ed5965eb0be 100644 --- a/trunk/net/tipc/subscr.c +++ b/trunk/net/tipc/subscr.c @@ -304,9 +304,9 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, } /* Refuse subscription if global limit exceeded */ - if (atomic_read(&topsrv.subscription_count) >= TIPC_MAX_SUBSCRIPTIONS) { + if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { pr_warn("Subscription rejected, limit reached (%u)\n", - TIPC_MAX_SUBSCRIPTIONS); + tipc_max_subscriptions); subscr_terminate(subscriber); return NULL; } diff --git a/trunk/net/xfrm/xfrm_policy.c b/trunk/net/xfrm/xfrm_policy.c index 6405764eaa82..5ad4d2c4b83c 100644 --- a/trunk/net/xfrm/xfrm_policy.c +++ b/trunk/net/xfrm/xfrm_policy.c @@ -2501,11 +2501,11 @@ static void __net_init xfrm_dst_ops_init(struct net *net) struct xfrm_policy_afinfo *afinfo; rcu_read_lock_bh(); - afinfo = rcu_dereference_bh(xfrm_policy_afinfo[AF_INET]); + afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]); if (afinfo) net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops; #if IS_ENABLED(CONFIG_IPV6) - afinfo = rcu_dereference_bh(xfrm_policy_afinfo[AF_INET6]); + afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]); if (afinfo) net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops; #endif