Commit 40e8f0b4 authored by David S. Miller's avatar David S. Miller

Merge branch 'udp-a-few-fixes'

Paolo Abeni says:

====================
udp: a few fixes

This series includes some UDP-related fixlet. All this stuff has been
pointed out by the sparse tool. The first two patches are just annotation
related, while the last 2 cover some very unlikely races.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6ff7b060 92b95364
...@@ -562,10 +562,12 @@ static int __udp4_lib_err_encap_no_sk(struct sk_buff *skb, u32 info) ...@@ -562,10 +562,12 @@ static int __udp4_lib_err_encap_no_sk(struct sk_buff *skb, u32 info)
for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) { for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) {
int (*handler)(struct sk_buff *skb, u32 info); int (*handler)(struct sk_buff *skb, u32 info);
const struct ip_tunnel_encap_ops *encap;
if (!iptun_encaps[i]) encap = rcu_dereference(iptun_encaps[i]);
if (!encap)
continue; continue;
handler = rcu_dereference(iptun_encaps[i]->err_handler); handler = encap->err_handler;
if (handler && !handler(skb, info)) if (handler && !handler(skb, info))
return 0; return 0;
} }
......
...@@ -72,7 +72,7 @@ static int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, ...@@ -72,7 +72,7 @@ static int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
static int gue6_err_proto_handler(int proto, struct sk_buff *skb, static int gue6_err_proto_handler(int proto, struct sk_buff *skb,
struct inet6_skb_parm *opt, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, u32 info) u8 type, u8 code, int offset, __be32 info)
{ {
const struct inet6_protocol *ipprot; const struct inet6_protocol *ipprot;
......
...@@ -288,8 +288,8 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -288,8 +288,8 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
int peeked, peeking, off; int peeked, peeking, off;
int err; int err;
int is_udplite = IS_UDPLITE(sk); int is_udplite = IS_UDPLITE(sk);
struct udp_mib __percpu *mib;
bool checksum_valid = false; bool checksum_valid = false;
struct udp_mib *mib;
int is_udp4; int is_udp4;
if (flags & MSG_ERRQUEUE) if (flags & MSG_ERRQUEUE)
...@@ -420,17 +420,19 @@ EXPORT_SYMBOL(udpv6_encap_enable); ...@@ -420,17 +420,19 @@ EXPORT_SYMBOL(udpv6_encap_enable);
*/ */
static int __udp6_lib_err_encap_no_sk(struct sk_buff *skb, static int __udp6_lib_err_encap_no_sk(struct sk_buff *skb,
struct inet6_skb_parm *opt, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, u32 info) u8 type, u8 code, int offset, __be32 info)
{ {
int i; int i;
for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) { for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) {
int (*handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, int (*handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, u32 info); u8 type, u8 code, int offset, __be32 info);
const struct ip6_tnl_encap_ops *encap;
if (!ip6tun_encaps[i]) encap = rcu_dereference(ip6tun_encaps[i]);
if (!encap)
continue; continue;
handler = rcu_dereference(ip6tun_encaps[i]->err_handler); handler = encap->err_handler;
if (handler && !handler(skb, opt, type, code, offset, info)) if (handler && !handler(skb, opt, type, code, offset, info))
return 0; return 0;
} }
......
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