Skip to content

Commit 40e8f0b

Browse files
committed
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: David S. Miller <davem@davemloft.net>
2 parents 6ff7b06 + 92b9536 commit 40e8f0b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

net/ipv4/udp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,12 @@ static int __udp4_lib_err_encap_no_sk(struct sk_buff *skb, u32 info)
562562

563563
for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) {
564564
int (*handler)(struct sk_buff *skb, u32 info);
565+
const struct ip_tunnel_encap_ops *encap;
565566

566-
if (!iptun_encaps[i])
567+
encap = rcu_dereference(iptun_encaps[i]);
568+
if (!encap)
567569
continue;
568-
handler = rcu_dereference(iptun_encaps[i]->err_handler);
570+
handler = encap->err_handler;
569571
if (handler && !handler(skb, info))
570572
return 0;
571573
}

net/ipv6/fou6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static int gue6_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
7272

7373
static int gue6_err_proto_handler(int proto, struct sk_buff *skb,
7474
struct inet6_skb_parm *opt,
75-
u8 type, u8 code, int offset, u32 info)
75+
u8 type, u8 code, int offset, __be32 info)
7676
{
7777
const struct inet6_protocol *ipprot;
7878

net/ipv6/udp.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
288288
int peeked, peeking, off;
289289
int err;
290290
int is_udplite = IS_UDPLITE(sk);
291+
struct udp_mib __percpu *mib;
291292
bool checksum_valid = false;
292-
struct udp_mib *mib;
293293
int is_udp4;
294294

295295
if (flags & MSG_ERRQUEUE)
@@ -420,17 +420,19 @@ EXPORT_SYMBOL(udpv6_encap_enable);
420420
*/
421421
static int __udp6_lib_err_encap_no_sk(struct sk_buff *skb,
422422
struct inet6_skb_parm *opt,
423-
u8 type, u8 code, int offset, u32 info)
423+
u8 type, u8 code, int offset, __be32 info)
424424
{
425425
int i;
426426

427427
for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) {
428428
int (*handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
429-
u8 type, u8 code, int offset, u32 info);
429+
u8 type, u8 code, int offset, __be32 info);
430+
const struct ip6_tnl_encap_ops *encap;
430431

431-
if (!ip6tun_encaps[i])
432+
encap = rcu_dereference(ip6tun_encaps[i]);
433+
if (!encap)
432434
continue;
433-
handler = rcu_dereference(ip6tun_encaps[i]->err_handler);
435+
handler = encap->err_handler;
434436
if (handler && !handler(skb, opt, type, code, offset, info))
435437
return 0;
436438
}

0 commit comments

Comments
 (0)