mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 14:50:19 +00:00
Merge branch 'tipc-next'
Erik Hugne says: ==================== tipc: bug fix and some improvements Most important is a fix for a nullptr exception that would occur when name table subscriptions fail. The remaining patches are performance improvements and cosmetic changes. v2: remove unnecessary whitespace in patch #2 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
721a57a02d
@ -742,7 +742,7 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bearer_disable(net, bearer, false);
|
||||
bearer_disable(net, bearer, true);
|
||||
rtnl_unlock();
|
||||
|
||||
return 0;
|
||||
|
@ -50,8 +50,9 @@
|
||||
* - the field's actual content and length is defined per media
|
||||
* - remaining unused bytes in the field are set to zero
|
||||
*/
|
||||
#define TIPC_MEDIA_ADDR_SIZE 32
|
||||
#define TIPC_MEDIA_INFO_SIZE 32
|
||||
#define TIPC_MEDIA_TYPE_OFFSET 3
|
||||
#define TIPC_MEDIA_ADDR_OFFSET 4
|
||||
|
||||
/*
|
||||
* Identifiers of supported TIPC media types
|
||||
@ -76,7 +77,7 @@ struct tipc_node_map {
|
||||
* @broadcast: non-zero if address is a broadcast address
|
||||
*/
|
||||
struct tipc_media_addr {
|
||||
u8 value[TIPC_MEDIA_ADDR_SIZE];
|
||||
u8 value[TIPC_MEDIA_INFO_SIZE];
|
||||
u8 media_id;
|
||||
u8 broadcast;
|
||||
};
|
||||
|
@ -37,8 +37,6 @@
|
||||
#include "core.h"
|
||||
#include "bearer.h"
|
||||
|
||||
#define ETH_ADDR_OFFSET 4 /* MAC addr position inside address field */
|
||||
|
||||
/* Convert Ethernet address (media address format) to string */
|
||||
static int tipc_eth_addr2str(struct tipc_media_addr *addr,
|
||||
char *strbuf, int bufsz)
|
||||
@ -53,9 +51,9 @@ static int tipc_eth_addr2str(struct tipc_media_addr *addr,
|
||||
/* Convert from media address format to discovery message addr format */
|
||||
static int tipc_eth_addr2msg(char *msg, struct tipc_media_addr *addr)
|
||||
{
|
||||
memset(msg, 0, TIPC_MEDIA_ADDR_SIZE);
|
||||
memset(msg, 0, TIPC_MEDIA_INFO_SIZE);
|
||||
msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH;
|
||||
memcpy(msg + ETH_ADDR_OFFSET, addr->value, ETH_ALEN);
|
||||
memcpy(msg + TIPC_MEDIA_ADDR_OFFSET, addr->value, ETH_ALEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -79,7 +77,7 @@ static int tipc_eth_msg2addr(struct tipc_bearer *b,
|
||||
char *msg)
|
||||
{
|
||||
/* Skip past preamble: */
|
||||
msg += ETH_ADDR_OFFSET;
|
||||
msg += TIPC_MEDIA_ADDR_OFFSET;
|
||||
return tipc_eth_raw2addr(b, addr, msg);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ static int tipc_ib_addr2str(struct tipc_media_addr *a, char *str_buf,
|
||||
/* Convert from media address format to discovery message addr format */
|
||||
static int tipc_ib_addr2msg(char *msg, struct tipc_media_addr *addr)
|
||||
{
|
||||
memset(msg, 0, TIPC_MEDIA_ADDR_SIZE);
|
||||
memset(msg, 0, TIPC_MEDIA_INFO_SIZE);
|
||||
memcpy(msg, addr->value, INFINIBAND_ALEN);
|
||||
return 0;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ struct plist;
|
||||
|
||||
#define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE)
|
||||
|
||||
#define TIPC_MEDIA_ADDR_OFFSET 5
|
||||
#define TIPC_MEDIA_INFO_OFFSET 5
|
||||
|
||||
/**
|
||||
* TIPC message buffer code
|
||||
@ -688,7 +688,7 @@ static inline void msg_set_redundant_link(struct tipc_msg *m, u32 r)
|
||||
|
||||
static inline char *msg_media_addr(struct tipc_msg *m)
|
||||
{
|
||||
return (char *)&m->hdr[TIPC_MEDIA_ADDR_OFFSET];
|
||||
return (char *)&m->hdr[TIPC_MEDIA_INFO_OFFSET];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -98,7 +98,7 @@ void named_cluster_distribute(struct net *net, struct sk_buff *skb)
|
||||
continue;
|
||||
if (!tipc_node_active_links(node))
|
||||
continue;
|
||||
oskb = skb_copy(skb, GFP_ATOMIC);
|
||||
oskb = pskb_copy(skb, GFP_ATOMIC);
|
||||
if (!oskb)
|
||||
break;
|
||||
msg_set_destnode(buf_msg(oskb), dnode);
|
||||
|
@ -162,19 +162,6 @@ static void subscr_del(struct tipc_subscription *sub)
|
||||
atomic_dec(&tn->subscription_count);
|
||||
}
|
||||
|
||||
/**
|
||||
* subscr_terminate - terminate communication with a subscriber
|
||||
*
|
||||
* Note: Must call it in process context since it might sleep.
|
||||
*/
|
||||
static void subscr_terminate(struct tipc_subscription *sub)
|
||||
{
|
||||
struct tipc_subscriber *subscriber = sub->subscriber;
|
||||
struct tipc_net *tn = net_generic(sub->net, tipc_net_id);
|
||||
|
||||
tipc_conn_terminate(tn->topsrv, subscriber->conid);
|
||||
}
|
||||
|
||||
static void subscr_release(struct tipc_subscriber *subscriber)
|
||||
{
|
||||
struct tipc_subscription *sub;
|
||||
@ -312,16 +299,14 @@ static void subscr_conn_msg_event(struct net *net, int conid,
|
||||
{
|
||||
struct tipc_subscriber *subscriber = usr_data;
|
||||
struct tipc_subscription *sub = NULL;
|
||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
||||
|
||||
spin_lock_bh(&subscriber->lock);
|
||||
if (subscr_subscribe(net, (struct tipc_subscr *)buf, subscriber,
|
||||
&sub) < 0) {
|
||||
spin_unlock_bh(&subscriber->lock);
|
||||
subscr_terminate(sub);
|
||||
return;
|
||||
}
|
||||
subscr_subscribe(net, (struct tipc_subscr *)buf, subscriber, &sub);
|
||||
if (sub)
|
||||
tipc_nametbl_subscribe(sub);
|
||||
else
|
||||
tipc_conn_terminate(tn->topsrv, subscriber->conid);
|
||||
spin_unlock_bh(&subscriber->lock);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user