Skip to content

Commit ff269e2

Browse files
committed
Merge tag 'net-next-6.7-followup' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
Pull more networking updates from Jakub Kicinski: - Support GRO decapsulation for IPsec ESP in UDP - Add a handful of MODULE_DESCRIPTION()s - Drop questionable alignment check in TCP AO to avoid build issue after changes in the crypto tree * tag 'net-next-6.7-followup' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: net: tcp: remove call to obsolete crypto_ahash_alignmask() net: fill in MODULE_DESCRIPTION()s under drivers/net/ net: fill in MODULE_DESCRIPTION()s under net/802* net: fill in MODULE_DESCRIPTION()s under net/core net: fill in MODULE_DESCRIPTION()s in kuba@'s modules xfrm: policy: fix layer 4 flowi decoding xfrm Fix use after free in __xfrm6_udp_encap_rcv. xfrm: policy: replace session decode with flow dissector xfrm: move mark and oif flowi decode into common code xfrm: pass struct net to xfrm_decode_session wrappers xfrm: Support GRO for IPv6 ESP in UDP encapsulation xfrm: Support GRO for IPv4 ESP in UDP encapsulation xfrm: Use the XFRM_GRO to indicate a GRO call on input xfrm: Annotate struct xfrm_sec_ctx with __counted_by xfrm: Remove unused function declarations
2 parents 05bf73a + f2fbb90 commit ff269e2

39 files changed

+361
-247
lines changed

drivers/net/amt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,5 +3449,6 @@ static void __exit amt_fini(void)
34493449
module_exit(amt_fini);
34503450

34513451
MODULE_LICENSE("GPL");
3452+
MODULE_DESCRIPTION("Driver for Automatic Multicast Tunneling (AMT)");
34523453
MODULE_AUTHOR("Taehee Yoo <[email protected]>");
34533454
MODULE_ALIAS_RTNL_LINK("amt");

drivers/net/dummy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,5 @@ static void __exit dummy_cleanup_module(void)
202202
module_init(dummy_init_module);
203203
module_exit(dummy_cleanup_module);
204204
MODULE_LICENSE("GPL");
205+
MODULE_DESCRIPTION("Dummy netdevice driver which discards all packets sent to it");
205206
MODULE_ALIAS_RTNL_LINK(DRV_NAME);

drivers/net/eql.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,4 +607,5 @@ static void __exit eql_cleanup_module(void)
607607

608608
module_init(eql_init_module);
609609
module_exit(eql_cleanup_module);
610+
MODULE_DESCRIPTION("Equalizer Load-balancer for serial network interfaces");
610611
MODULE_LICENSE("GPL");

drivers/net/ifb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,5 +454,6 @@ static void __exit ifb_cleanup_module(void)
454454
module_init(ifb_init_module);
455455
module_exit(ifb_cleanup_module);
456456
MODULE_LICENSE("GPL");
457+
MODULE_DESCRIPTION("Intermediate Functional Block (ifb) netdevice driver for sharing of resources and ingress packet queuing");
457458
MODULE_AUTHOR("Jamal Hadi Salim");
458459
MODULE_ALIAS_RTNL_LINK("ifb");

drivers/net/macvtap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,5 +250,6 @@ static void __exit macvtap_exit(void)
250250
module_exit(macvtap_exit);
251251

252252
MODULE_ALIAS_RTNL_LINK("macvtap");
253+
MODULE_DESCRIPTION("MAC-VLAN based tap driver");
253254
MODULE_AUTHOR("Arnd Bergmann <[email protected]>");
254255
MODULE_LICENSE("GPL");

drivers/net/netdevsim/netdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,5 @@ static void __exit nsim_module_exit(void)
470470
module_init(nsim_module_init);
471471
module_exit(nsim_module_exit);
472472
MODULE_LICENSE("GPL");
473+
MODULE_DESCRIPTION("Simulated networking device for testing");
473474
MODULE_ALIAS_RTNL_LINK(DRV_NAME);

drivers/net/sungem_phy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,4 +1194,5 @@ int sungem_phy_probe(struct mii_phy *phy, int mii_id)
11941194
}
11951195

11961196
EXPORT_SYMBOL(sungem_phy_probe);
1197+
MODULE_DESCRIPTION("PHY drivers for the sungem Ethernet MAC driver");
11971198
MODULE_LICENSE("GPL");

drivers/net/tap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,7 @@ void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev)
13991399
}
14001400
EXPORT_SYMBOL_GPL(tap_destroy_cdev);
14011401

1402+
MODULE_DESCRIPTION("Common library for drivers implementing the TAP interface");
14021403
MODULE_AUTHOR("Arnd Bergmann <[email protected]>");
14031404
MODULE_AUTHOR("Sainath Grandhi <[email protected]>");
14041405
MODULE_LICENSE("GPL");

drivers/net/wireless/mediatek/mt7601u/usb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ static int mt7601u_resume(struct usb_interface *usb_intf)
365365

366366
MODULE_DEVICE_TABLE(usb, mt7601u_device_table);
367367
MODULE_FIRMWARE(MT7601U_FIRMWARE);
368+
MODULE_DESCRIPTION("MediaTek MT7601U USB Wireless LAN driver");
368369
MODULE_LICENSE("GPL");
369370

370371
static struct usb_driver mt7601u_driver = {

include/net/gro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct napi_gro_cb {
4141
/* Number of segments aggregated. */
4242
u16 count;
4343

44-
/* Used in ipv6_gro_receive() and foo-over-udp */
44+
/* Used in ipv6_gro_receive() and foo-over-udp and esp-in-udp */
4545
u16 proto;
4646

4747
/* Used in napi_gro_cb::free */

include/net/ipv6_stubs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ struct ipv6_stub {
6060
#if IS_ENABLED(CONFIG_XFRM)
6161
void (*xfrm6_local_rxpmtu)(struct sk_buff *skb, u32 mtu);
6262
int (*xfrm6_udp_encap_rcv)(struct sock *sk, struct sk_buff *skb);
63+
struct sk_buff *(*xfrm6_gro_udp_encap_rcv)(struct sock *sk,
64+
struct list_head *head,
65+
struct sk_buff *skb);
6366
int (*xfrm6_rcv_encap)(struct sk_buff *skb, int nexthdr, __be32 spi,
6467
int encap_type);
6568
#endif

include/net/xfrm.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,20 +1207,20 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
12071207
return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1);
12081208
}
12091209

1210-
int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1210+
int __xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl,
12111211
unsigned int family, int reverse);
12121212

1213-
static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1213+
static inline int xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl,
12141214
unsigned int family)
12151215
{
1216-
return __xfrm_decode_session(skb, fl, family, 0);
1216+
return __xfrm_decode_session(net, skb, fl, family, 0);
12171217
}
12181218

1219-
static inline int xfrm_decode_session_reverse(struct sk_buff *skb,
1219+
static inline int xfrm_decode_session_reverse(struct net *net, struct sk_buff *skb,
12201220
struct flowi *fl,
12211221
unsigned int family)
12221222
{
1223-
return __xfrm_decode_session(skb, fl, family, 1);
1223+
return __xfrm_decode_session(net, skb, fl, family, 1);
12241224
}
12251225

12261226
int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
@@ -1296,7 +1296,7 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk
12961296
{
12971297
return 1;
12981298
}
1299-
static inline int xfrm_decode_session_reverse(struct sk_buff *skb,
1299+
static inline int xfrm_decode_session_reverse(struct net *net, struct sk_buff *skb,
13001300
struct flowi *fl,
13011301
unsigned int family)
13021302
{
@@ -1669,7 +1669,6 @@ int pktgen_xfrm_outer_mode_output(struct xfrm_state *x, struct sk_buff *skb);
16691669
#endif
16701670

16711671
void xfrm_local_error(struct sk_buff *skb, int mtu);
1672-
int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16731672
int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
16741673
int encap_type);
16751674
int xfrm4_transport_finish(struct sk_buff *skb, int async);
@@ -1689,7 +1688,6 @@ int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char prot
16891688
int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
16901689
int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
16911690
void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1692-
int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
16931691
int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi,
16941692
struct ip6_tnl *t);
16951693
int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
@@ -1712,6 +1710,10 @@ int xfrm6_output(struct net *net, struct sock *sk, struct sk_buff *skb);
17121710
void xfrm6_local_rxpmtu(struct sk_buff *skb, u32 mtu);
17131711
int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
17141712
int xfrm6_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1713+
struct sk_buff *xfrm4_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
1714+
struct sk_buff *skb);
1715+
struct sk_buff *xfrm6_gro_udp_encap_rcv(struct sock *sk, struct list_head *head,
1716+
struct sk_buff *skb);
17151717
int xfrm_user_policy(struct sock *sk, int optname, sockptr_t optval,
17161718
int optlen);
17171719
#else

include/uapi/linux/xfrm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <linux/in6.h>
66
#include <linux/types.h>
7+
#include <linux/stddef.h>
78

89
/* All of the structures in this file may not change size as they are
910
* passed into the kernel from userspace via netlink sockets.
@@ -33,7 +34,7 @@ struct xfrm_sec_ctx {
3334
__u8 ctx_alg;
3435
__u16 ctx_len;
3536
__u32 ctx_sid;
36-
char ctx_str[];
37+
char ctx_str[] __counted_by(ctx_len);
3738
};
3839

3940
/* Security Context Domains of Interpretation */

net/802/fddi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,5 @@ struct net_device *alloc_fddidev(int sizeof_priv)
175175
}
176176
EXPORT_SYMBOL(alloc_fddidev);
177177

178+
MODULE_DESCRIPTION("Core routines for FDDI network devices");
178179
MODULE_LICENSE("GPL");

net/802/garp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
static unsigned int garp_join_time __read_mostly = 200;
2222
module_param(garp_join_time, uint, 0644);
2323
MODULE_PARM_DESC(garp_join_time, "Join time in ms (default 200ms)");
24+
MODULE_DESCRIPTION("IEEE 802.1D Generic Attribute Registration Protocol (GARP)");
2425
MODULE_LICENSE("GPL");
2526

2627
static const struct garp_state_trans {

net/802/mrp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static unsigned int mrp_periodic_time __read_mostly = 1000;
2626
module_param(mrp_periodic_time, uint, 0644);
2727
MODULE_PARM_DESC(mrp_periodic_time, "Periodic time in ms (default 1s)");
2828

29+
MODULE_DESCRIPTION("IEEE 802.1Q Multiple Registration Protocol (MRP)");
2930
MODULE_LICENSE("GPL");
3031

3132
static const u8

net/802/p8022.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ void unregister_8022_client(struct datalink_proto *proto)
6060
EXPORT_SYMBOL(register_8022_client);
6161
EXPORT_SYMBOL(unregister_8022_client);
6262

63+
MODULE_DESCRIPTION("Support for 802.2 demultiplexing off Ethernet");
6364
MODULE_LICENSE("GPL");

net/802/psnap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,5 @@ void unregister_snap_client(struct datalink_proto *proto)
160160
kfree(proto);
161161
}
162162

163+
MODULE_DESCRIPTION("SNAP data link layer. Derived from 802.2");
163164
MODULE_LICENSE("GPL");

net/802/stp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,5 @@ void stp_proto_unregister(const struct stp_proto *proto)
9898
}
9999
EXPORT_SYMBOL_GPL(stp_proto_unregister);
100100

101+
MODULE_DESCRIPTION("SAP demux for IEEE 802.1D Spanning Tree Protocol (STP)");
101102
MODULE_LICENSE("GPL");

net/8021q/vlan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,5 +738,6 @@ static void __exit vlan_cleanup_module(void)
738738
module_init(vlan_proto_init);
739739
module_exit(vlan_cleanup_module);
740740

741+
MODULE_DESCRIPTION("802.1Q/802.1ad VLAN Protocol");
741742
MODULE_LICENSE("GPL");
742743
MODULE_VERSION(DRV_VERSION);

net/core/dev_addr_lists_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@ static struct kunit_suite dev_addr_test_suite = {
233233
};
234234
kunit_test_suite(dev_addr_test_suite);
235235

236+
MODULE_DESCRIPTION("KUnit tests for struct netdev_hw_addr_list");
236237
MODULE_LICENSE("GPL");

net/core/selftests.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,5 +405,6 @@ void net_selftest_get_strings(u8 *data)
405405
}
406406
EXPORT_SYMBOL_GPL(net_selftest_get_strings);
407407

408+
MODULE_DESCRIPTION("Common library for generic PHY ethtool selftests");
408409
MODULE_LICENSE("GPL v2");
409410
MODULE_AUTHOR("Oleksij Rempel <[email protected]>");

net/ipv4/esp4_offload.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
3333
int offset = skb_gro_offset(skb);
3434
struct xfrm_offload *xo;
3535
struct xfrm_state *x;
36+
int encap_type = 0;
3637
__be32 seq;
3738
__be32 spi;
3839

@@ -70,14 +71,17 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
7071

7172
xo->flags |= XFRM_GRO;
7273

74+
if (NAPI_GRO_CB(skb)->proto == IPPROTO_UDP)
75+
encap_type = UDP_ENCAP_ESPINUDP;
76+
7377
XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
7478
XFRM_SPI_SKB_CB(skb)->family = AF_INET;
7579
XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
7680
XFRM_SPI_SKB_CB(skb)->seq = seq;
7781

7882
/* We don't need to handle errors from xfrm_input, it does all
7983
* the error handling and frees the resources on error. */
80-
xfrm_input(skb, IPPROTO_ESP, spi, -2);
84+
xfrm_input(skb, IPPROTO_ESP, spi, encap_type);
8185

8286
return ERR_PTR(-EINPROGRESS);
8387
out_reset:

net/ipv4/icmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
517517
} else
518518
return rt;
519519

520-
err = xfrm_decode_session_reverse(skb_in, flowi4_to_flowi(&fl4_dec), AF_INET);
520+
err = xfrm_decode_session_reverse(net, skb_in, flowi4_to_flowi(&fl4_dec), AF_INET);
521521
if (err)
522522
goto relookup_failed;
523523

net/ipv4/ip_vti.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
288288
switch (skb->protocol) {
289289
case htons(ETH_P_IP):
290290
memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
291-
xfrm_decode_session(skb, &fl, AF_INET);
291+
xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET);
292292
break;
293293
case htons(ETH_P_IPV6):
294294
memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
295-
xfrm_decode_session(skb, &fl, AF_INET6);
295+
xfrm_decode_session(dev_net(dev), skb, &fl, AF_INET6);
296296
break;
297297
default:
298298
goto tx_err;

net/ipv4/netfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, un
6262

6363
#ifdef CONFIG_XFRM
6464
if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
65-
xfrm_decode_session(skb, flowi4_to_flowi(&fl4), AF_INET) == 0) {
65+
xfrm_decode_session(net, skb, flowi4_to_flowi(&fl4), AF_INET) == 0) {
6666
struct dst_entry *dst = skb_dst(skb);
6767
skb_dst_set(skb, NULL);
6868
dst = xfrm_lookup(net, dst, flowi4_to_flowi(&fl4), sk, 0);

net/ipv4/tcp_ao.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,10 +1533,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk,
15331533
goto err_free_pool;
15341534

15351535
tfm = crypto_ahash_reqtfm(hp.req);
1536-
if (crypto_ahash_alignmask(tfm) > TCP_AO_KEY_ALIGN) {
1537-
err = -EOPNOTSUPP;
1538-
goto err_pool_end;
1539-
}
15401536
digest_size = crypto_ahash_digestsize(tfm);
15411537
tcp_sigpool_end(&hp);
15421538

@@ -1551,8 +1547,6 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk,
15511547
key->digest_size = digest_size;
15521548
return key;
15531549

1554-
err_pool_end:
1555-
tcp_sigpool_end(&hp);
15561550
err_free_pool:
15571551
tcp_sigpool_release(pool_id);
15581552
return ERR_PTR(err);

net/ipv4/udp.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,6 +2630,19 @@ void udp_destroy_sock(struct sock *sk)
26302630
}
26312631
}
26322632

2633+
static void set_xfrm_gro_udp_encap_rcv(__u16 encap_type, unsigned short family,
2634+
struct sock *sk)
2635+
{
2636+
#ifdef CONFIG_XFRM
2637+
if (udp_test_bit(GRO_ENABLED, sk) && encap_type == UDP_ENCAP_ESPINUDP) {
2638+
if (family == AF_INET)
2639+
WRITE_ONCE(udp_sk(sk)->gro_receive, xfrm4_gro_udp_encap_rcv);
2640+
else if (IS_ENABLED(CONFIG_IPV6) && family == AF_INET6)
2641+
WRITE_ONCE(udp_sk(sk)->gro_receive, ipv6_stub->xfrm6_gro_udp_encap_rcv);
2642+
}
2643+
#endif
2644+
}
2645+
26332646
/*
26342647
* Socket option code for UDP
26352648
*/
@@ -2679,6 +2692,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
26792692
case 0:
26802693
#ifdef CONFIG_XFRM
26812694
case UDP_ENCAP_ESPINUDP:
2695+
set_xfrm_gro_udp_encap_rcv(val, sk->sk_family, sk);
2696+
fallthrough;
26822697
case UDP_ENCAP_ESPINUDP_NON_IKE:
26832698
#if IS_ENABLED(CONFIG_IPV6)
26842699
if (sk->sk_family == AF_INET6)
@@ -2721,6 +2736,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
27212736
udp_tunnel_encap_enable(sk);
27222737
udp_assign_bit(GRO_ENABLED, sk, valbool);
27232738
udp_assign_bit(ACCEPT_L4, sk, valbool);
2739+
set_xfrm_gro_udp_encap_rcv(up->encap_type, sk->sk_family, sk);
27242740
break;
27252741

27262742
/*

0 commit comments

Comments
 (0)