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

Commit c7cad0d6 authored by Jon Paul Maloy's avatar Jon Paul Maloy Committed by David S. Miller
Browse files

tipc: move linearization of buffers to generic code



In commit 5cbb28a4 ("tipc: linearize arriving NAME_DISTR
and LINK_PROTO buffers") we added linearization of NAME_DISTRIBUTOR,
LINK_PROTOCOL/RESET and LINK_PROTOCOL/ACTIVATE to the function
tipc_udp_recv(). The location of the change was selected in order
to make the commit easily appliable to 'net' and 'stable'.

We now move this linearization to where it should be done, in the
functions tipc_named_rcv() and tipc_link_proto_rcv() respectively.

Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 12ded5ca
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1260,6 +1260,8 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
		/* fall thru' */
		/* fall thru' */


	case ACTIVATE_MSG:
	case ACTIVATE_MSG:
		skb_linearize(skb);
		hdr = buf_msg(skb);


		/* Complete own link name with peer's interface name */
		/* Complete own link name with peer's interface name */
		if_name =  strrchr(l->name, ':') + 1;
		if_name =  strrchr(l->name, ':') + 1;
+1 −0
Original line number Original line Diff line number Diff line
@@ -397,6 +397,7 @@ void tipc_named_rcv(struct net *net, struct sk_buff_head *inputq)


	spin_lock_bh(&tn->nametbl_lock);
	spin_lock_bh(&tn->nametbl_lock);
	for (skb = skb_dequeue(inputq); skb; skb = skb_dequeue(inputq)) {
	for (skb = skb_dequeue(inputq); skb; skb = skb_dequeue(inputq)) {
		skb_linearize(skb);
		msg = buf_msg(skb);
		msg = buf_msg(skb);
		mtype = msg_type(msg);
		mtype = msg_type(msg);
		item = (struct distr_item *)msg_data(msg);
		item = (struct distr_item *)msg_data(msg);
+0 −5
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@
#include <linux/tipc_netlink.h>
#include <linux/tipc_netlink.h>
#include "core.h"
#include "core.h"
#include "bearer.h"
#include "bearer.h"
#include "msg.h"


/* IANA assigned UDP port */
/* IANA assigned UDP port */
#define UDP_PORT_DEFAULT	6118
#define UDP_PORT_DEFAULT	6118
@@ -221,10 +220,6 @@ static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb)
{
{
	struct udp_bearer *ub;
	struct udp_bearer *ub;
	struct tipc_bearer *b;
	struct tipc_bearer *b;
	int usr = msg_user(buf_msg(skb));

	if ((usr == LINK_PROTOCOL) || (usr == NAME_DISTRIBUTOR))
		skb_linearize(skb);


	ub = rcu_dereference_sk_user_data(sk);
	ub = rcu_dereference_sk_user_data(sk);
	if (!ub) {
	if (!ub) {