Commit 5cbb28a4 authored by Jon Paul Maloy's avatar Jon Paul Maloy Committed by David S. Miller

tipc: linearize arriving NAME_DISTR and LINK_PROTO buffers

Testing of the new UDP bearer has revealed that reception of
NAME_DISTRIBUTOR, LINK_PROTOCOL/RESET and LINK_PROTOCOL/ACTIVATE
message buffers is not prepared for the case that those may be
non-linear.

We now linearize all such buffers before they are delivered up to the
generic reception layer.

In order for the commit to apply cleanly to 'net' and 'stable', we do
the change in the function tipc_udp_recv() for now. Later, we will post
a commit to 'net-next' moving the linearization to generic code, in
tipc_named_rcv() and tipc_link_proto_rcv().

Fixes: commit d0f91938 ("tipc: add ip/udp media type")
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4444574
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#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
...@@ -222,6 +223,10 @@ static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb) ...@@ -222,6 +223,10 @@ 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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment