Commit graph

711 commits

Author SHA1 Message Date
Ksawlii
fffb3a7453 Revert "netfilter: nf_reject_ipv6: fix nf_reject_ip6_tcphdr_put()"
This reverts commit 103bb84d43.
2024-11-24 00:23:18 +01:00
Ksawlii
4da99c6b03 Revert "net: ipv6: select DST_CACHE from IPV6_RPL_LWTUNNEL"
This reverts commit c457c95e8c.
2024-11-24 00:23:18 +01:00
Ksawlii
8c89e5a8e9 Revert "net: qrtr: Update packets cloning when broadcasting"
This reverts commit 4e47049a3b.
2024-11-24 00:23:18 +01:00
Ksawlii
34b5adf14b Revert "netfilter: nf_tables: Keep deleted flowtable hooks until after RCU"
This reverts commit 9dff7ecbaa.
2024-11-24 00:23:18 +01:00
Ksawlii
dfba2abdca Revert "netfilter: ctnetlink: compile ctnetlink_label_size with CONFIG_NF_CONNTRACK_EVENTS"
This reverts commit 0184a94a2d.
2024-11-24 00:23:18 +01:00
Ksawlii
ad9cd009c0 Revert "mptcp: fix sometimes-uninitialized warning"
This reverts commit 4f36f19902.
2024-11-24 00:23:17 +01:00
Ksawlii
179c4ebbc2 Revert "netfilter: nf_tables: prevent nf_skb_duplicated corruption"
This reverts commit ec98d49424.
2024-11-24 00:23:12 +01:00
Ksawlii
839e4817e0 Revert "net: avoid potential underflow in qdisc_pkt_len_init() with UFO"
This reverts commit 43c718d118.
2024-11-24 00:23:12 +01:00
Ksawlii
26d0ee6612 Revert "net: add more sanity checks to qdisc_pkt_len_init()"
This reverts commit db458c02bc.
2024-11-24 00:23:12 +01:00
Ksawlii
31a84aa710 Revert "ipv4: ip_gre: Fix drops of small packets in ipgre_xmit"
This reverts commit ae49cd62cc.
2024-11-24 00:23:12 +01:00
Ksawlii
5bdee7aa98 Revert "sctp: set sk_state back to CLOSED if autobind fails in sctp_listen_start"
This reverts commit cf4a4858f8.
2024-11-24 00:23:12 +01:00
Ksawlii
090bd5a30c Revert "Bluetooth: L2CAP: Fix not validating setsockopt user input"
This reverts commit 34810f683b.
2024-11-24 00:23:11 +01:00
Ksawlii
33e3696215 Revert "net: sched: consistently use rcu_replace_pointer() in taprio_change()"
This reverts commit 35c0601a6a.
2024-11-24 00:23:10 +01:00
Ksawlii
a3f4468004 Revert "tipc: guard against string buffer overrun"
This reverts commit ff9d241811.
2024-11-24 00:23:08 +01:00
Ksawlii
ffd61b39ca Revert "ipv4: Check !in_dev earlier for ioctl(SIOCSIFADDR)."
This reverts commit 1d847a620b.
2024-11-24 00:23:08 +01:00
Ksawlii
fb80fb4dc3 Revert "ipv4: Mask upper DSCP bits and ECN bits in NETLINK_FIB_LOOKUP family"
This reverts commit c6e6595d5c.
2024-11-24 00:23:08 +01:00
Ksawlii
13049ca517 Revert "tcp: avoid reusing FIN_WAIT2 when trying to find port in connect() process"
This reverts commit 5b2e4aef3f.
2024-11-24 00:23:07 +01:00
Ksawlii
5cb636f7a4 Revert "tcp: fix to allow timestamp undo if no retransmits were sent"
This reverts commit 0295a863b0.
2024-11-24 00:22:57 +01:00
Ksawlii
15d63378f5 Revert "tcp: fix tcp_enter_recovery() to zero retrans_stamp when it's safe"
This reverts commit 67a88846ee.
2024-11-24 00:22:57 +01:00
Ksawlii
e804fa0001 Revert "netfilter: br_netfilter: fix panic with metadata_dst skb"
This reverts commit 61d2ade0cb.
2024-11-24 00:22:57 +01:00
Ksawlii
6a3d675362 Revert "Bluetooth: RFCOMM: FIX possible deadlock in rfcomm_sk_state_change"
This reverts commit 727f05fda3.
2024-11-24 00:22:57 +01:00
Ksawlii
aa7000ca5b Revert "net/sched: accept TCA_STAB only for root qdisc"
This reverts commit 7ce031a5e7.
2024-11-24 00:22:56 +01:00
Ksawlii
bc50bf1f95 Revert "sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start"
This reverts commit 31c0dc7bbd.
2024-11-24 00:22:56 +01:00
Ksawlii
2fcfdbccc6 Revert "netfilter: rpfilter/fib: Populate flowic_l3mdev field"
This reverts commit 8c380d140f.
2024-11-24 00:22:56 +01:00
Ksawlii
174cc7adb2 Revert "netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces."
This reverts commit 748f8d93da.
2024-11-24 00:22:56 +01:00
Ksawlii
482f814c0a Revert "netfilter: fib: check correct rtable in vrf setups"
This reverts commit 12f2bab817.
2024-11-24 00:22:56 +01:00
Ksawlii
41a84ba01c Revert "net: Fix an unsafe loop on the list"
This reverts commit eddd768153.
2024-11-24 00:22:55 +01:00
Ksawlii
6a7d749ef9 Revert "xfrm: Pass flowi_oif or l3mdev as oif to xfrm_dst_lookup"
This reverts commit 40dbfea1fd.
2024-11-24 00:22:55 +01:00
Ksawlii
7b92e2530c Revert "net: seg6: fix seg6_lookup_any_nexthop() to handle VRFs using flowi_l3mdev"
This reverts commit f379de3e94.
2024-11-24 00:22:54 +01:00
Ksawlii
810bfe7bd4 Revert "netfilter: ip6t_rpfilter: Fix regression with VRF interfaces"
This reverts commit f26c3ffddf.
2024-11-24 00:22:54 +01:00
Ksawlii
bfa37c9cf0 Revert "wifi: mac80211: fix potential key use-after-free"
This reverts commit e5e07ee6ec.
2024-11-24 00:22:53 +01:00
Ksawlii
cafb5ebf44 Revert "Bluetooth: Remove debugfs directory on module init failure"
This reverts commit 66a71e8659.
2024-11-24 00:22:52 +01:00
Ksawlii
d22ac47288 Revert "mptcp: track and update contiguous data status"
This reverts commit dcd9060576.
2024-11-24 00:22:51 +01:00
Ksawlii
f17b8dfeea Revert "mptcp: handle consistently DSS corruption"
This reverts commit 3f4af240b0.
2024-11-24 00:22:51 +01:00
Ksawlii
6236b4ccaf Revert "tcp: fix mptcp DSS corruption due to large pmtu xmit"
This reverts commit cce6ef7552.
2024-11-24 00:22:51 +01:00
Johannes Berg
a2b08af2ca mac80211: always have ieee80211_sta_restart()
commit 3fa5a0f5b0d69e31c6476cd81afeca3cc25a4927 upstream.

When CONFIG_PM isn't defined we don't have the function
ieee80211_sta_restart() compiled in, but we always need
it now for firmware restart. Move it out of the ifdef.

Fixes: 7d352ccf1e99 ("mac80211: Add support to trigger sta disconnect on hardware restart")
Link: https://lore.kernel.org/r/20220312221957.1fa96c72db51.I8ecaa5f9402fede0272161e0531ab930b97fba3e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:06 +01:00
Felix Fietkau
2325aa9ece wifi: mac80211: do not pass a stopped vif to the driver in .get_txpower
commit 393b6bc174b0dd21bb2a36c13b36e62fc3474a23 upstream.

Avoid potentially crashing in the driver because of uninitialized private data

Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20241002095630.22431-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:05 +01:00
Pablo Neira Ayuso
c5a5eb2636 netfilter: nft_payload: sanitize offset and length before calling skb_checksum()
[ Upstream commit d5953d680f7e96208c29ce4139a0e38de87a57fe ]

If access to offset + length is larger than the skbuff length, then
skb_checksum() triggers BUG_ON().

skb_checksum() internally subtracts the length parameter while iterating
over skbuff, BUG_ON(len) at the end of it checks that the expected
length to be included in the checksum calculation is fully consumed.

Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
Reported-by: Slavin Liu <slavin-ayu@qq.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:04 +01:00
Benoît Monin
4454492a69 net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension
[ Upstream commit 04c20a9356f283da623903e81e7c6d5df7e4dc3c ]

As documented in skbuff.h, devices with NETIF_F_IPV6_CSUM capability
can only checksum TCP and UDP over IPv6 if the IP header does not
contains extension.

This is enforced for UDP packets emitted from user-space to an IPv6
address as they go through ip6_make_skb(), which calls
__ip6_append_data() where a check is done on the header size before
setting CHECKSUM_PARTIAL.

But the introduction of UDP encapsulation with fou6 added a code-path
where it is possible to get an skb with a partial UDP checksum and an
IPv6 header with extension:
* fou6 adds a UDP header with a partial checksum if the inner packet
does not contains a valid checksum.
* ip6_tunnel adds an IPv6 header with a destination option extension
header if encap_limit is non-zero (the default value is 4).

The thread linked below describes in more details how to reproduce the
problem with GRE-in-UDP tunnel.

Add a check on the network header size in skb_csum_hwoffload_help() to
make sure no IPv6 packet with extension header is handed to a network
device with NETIF_F_IPV6_CSUM capability.

Link: https://lore.kernel.org/netdev/26548921.1r3eYUQgxm@benoit.monin/T/#u
Fixes: aa3463d65e7b ("fou: Add encap ops for IPv6 tunnels")
Signed-off-by: Benoît Monin <benoit.monin@gmx.fr>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/5fbeecfc311ea182aa1d1c771725ab8b4cac515e.1729778144.git.benoit.monin@gmx.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:04 +01:00
Xin Long
6b64885b30 net: support ip generic csum processing in skb_csum_hwoffload_help
[ Upstream commit 62fafcd63139920eb25b3fbf154177ce3e6f3232 ]

NETIF_F_IP|IPV6_CSUM feature flag indicates UDP and TCP csum offload
while NETIF_F_HW_CSUM feature flag indicates ip generic csum offload
for HW, which includes not only for TCP/UDP csum, but also for other
protocols' csum like GRE's.

However, in skb_csum_hwoffload_help() it only checks features against
NETIF_F_CSUM_MASK(NETIF_F_HW|IP|IPV6_CSUM). So if it's a non TCP/UDP
packet and the features doesn't support NETIF_F_HW_CSUM, but supports
NETIF_F_IP|IPV6_CSUM only, it would still return 0 and leave the HW
to do csum.

This patch is to support ip generic csum processing by checking
NETIF_F_HW_CSUM for all protocols, and check (NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM) only for TCP and UDP.

Note that we're using skb->csum_offset to check if it's a TCP/UDP
proctol, this might be fragile. However, as Alex said, for now we
only have a few L4 protocols that are requesting Tx csum offload,
we'd better fix this until a new protocol comes with a same csum
offset.

v1->v2:
  - not extend skb->csum_not_inet, but use skb->csum_offset to tell
    if it's an UDP/TCP csum packet.
v2->v3:
  - add a note in the changelog, as Willem suggested.

Suggested-by: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:03 +01:00
Pedro Tammela
77b4f1a985 net/sched: stop qdisc_tree_reduce_backlog on TC_H_ROOT
[ Upstream commit 2e95c4384438adeaa772caa560244b1a2efef816 ]

In qdisc_tree_reduce_backlog, Qdiscs with major handle ffff: are assumed
to be either root or ingress. This assumption is bogus since it's valid
to create egress qdiscs with major handle ffff:
Budimir Markovic found that for qdiscs like DRR that maintain an active
class list, it will cause a UAF with a dangling class pointer.

In 066a3b5b2346, the concern was to avoid iterating over the ingress
qdisc since its parent is itself. The proper fix is to stop when parent
TC_H_ROOT is reached because the only way to retrieve ingress is when a
hierarchy which does not contain a ffff: major handle call into
qdisc_lookup with TC_H_MAJ(TC_H_ROOT).

In the scenario where major ffff: is an egress qdisc in any of the tree
levels, the updates will also propagate to TC_H_ROOT, which then the
iteration must stop.

Fixes: 066a3b5b2346 ("[NET_SCHED] sch_api: fix qdisc_tree_decrease_qlen() loop")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>

 net/sched/sch_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Horman <horms@kernel.org>

Link: https://patch.msgid.link/20241024165547.418570-1-jhs@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:03 +01:00
Youghandhar Chintala
6deb375c78 mac80211: Add support to trigger sta disconnect on hardware restart
[ Upstream commit 7d352ccf1e9935b5222ca84e8baeb07a0c8f94b9 ]

Currently in case of target hardware restart, we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a sta disconnect, in case of target
hw restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex changes and
will still be inefficient.

Tested on ath10k using WCN3990, QCA6174

Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
Link: https://lore.kernel.org/r/20220308115325.5246-2-youghand@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Stable-dep-of: 07a6e3b78a65 ("wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:03 +01:00
Johannes Berg
10941aba9a mac80211: do drv_reconfig_complete() before restarting all
[ Upstream commit 13dee10b30c058ee2c58c5da00339cc0d4201aa6 ]

When we reconfigure, the driver might do some things to complete
the reconfiguration. It's strange and could be broken in some
cases because we restart other works (e.g. remain-on-channel and
TX) before this happens, yet only start queues later.

Change this to do the reconfig complete when reconfiguration is
actually complete, not when we've already started doing other
things again.

For iwlwifi, this should fix a race where the reconfig can race
with TX, for ath10k and ath11k that also use this it won't make
a difference because they just start queues there, and mac80211
also stopped the queues and will restart them later as before.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211129152938.cab99f22fe19.Iefe494687f15fd85f77c1b989d1149c8efdfdc36@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Stable-dep-of: 07a6e3b78a65 ("wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:03 +01:00
Felix Fietkau
c27f6c8897 wifi: mac80211: skip non-uploaded keys in ieee80211_iter_keys
[ Upstream commit 52009b419355195912a628d0a9847922e90c348c ]

Sync iterator conditions with ieee80211_iter_keys_rcu.

Fixes: 830af02f24fb ("mac80211: allow driver to iterate keys")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20241006153630.87885-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:03 +01:00
Geert Uytterhoeven
adc59dbeb4 mac80211: MAC80211_MESSAGE_TRACING should depend on TRACING
[ Upstream commit b3e046c31441d182b954fc2f57b2dc38c71ad4bc ]

When tracing is disabled, there is no point in asking the user about
enabling tracing of all mac80211 debug messages.

Fixes: 3fae0273168026ed ("mac80211: trace debug messages")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://patch.msgid.link/85bbe38ce0df13350f45714e2dc288cc70947a19.1727179690.git.geert@linux-m68k.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:02 +01:00
Sabrina Dubroca
b7a65631b5 xfrm: validate new SA's prefixlen using SA family when sel.family is unset
[ Upstream commit 3f0ab59e6537c6a8f9e1b355b48f9c05a76e8563 ]

This expands the validation introduced in commit 07bf7908950a ("xfrm:
Validate address prefix lengths in the xfrm selector.")

syzbot created an SA with
    usersa.sel.family = AF_UNSPEC
    usersa.sel.prefixlen_s = 128
    usersa.family = AF_INET

Because of the AF_UNSPEC selector, verify_newsa_info doesn't put
limits on prefixlen_{s,d}. But then copy_from_user_state sets
x->sel.family to usersa.family (AF_INET). Do the same conversion in
verify_newsa_info before validating prefixlen_{s,d}, since that's how
prefixlen is going to be used later on.

Reported-by: syzbot+cc39f136925517aed571@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:02 +01:00
Dmitry Antipov
e10f4d31cc net: sched: fix use-after-free in taprio_change()
[ Upstream commit f504465970aebb2467da548f7c1efbbf36d0f44b ]

In 'taprio_change()', 'admin' pointer may become dangling due to sched
switch / removal caused by 'advance_sched()', and critical section
protected by 'q->current_entry_lock' is too small to prevent from such
a scenario (which causes use-after-free detected by KASAN). Fix this
by prefer 'rcu_replace_pointer()' over 'rcu_assign_pointer()' to update
'admin' immediately before an attempt to schedule freeing.

Fixes: a3d43c0d56f1 ("taprio: Add support adding an admin schedule")
Reported-by: syzbot+b65e0af58423fc8a73aa@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b65e0af58423fc8a73aa
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20241018051339.418890-1-dmantipov@yandex.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:01 +01:00
Eyal Birger
face97635f xfrm: respect ip protocols rules criteria when performing dst lookups
[ Upstream commit b8469721034300bbb6dec5b4bf32492c95e16a0c ]

The series in the "fixes" tag added the ability to consider L4 attributes
in routing rules.

The dst lookup on the outer packet of encapsulated traffic in the xfrm
code was not adapted to this change, thus routing behavior that relies
on L4 information is not respected.

Pass the ip protocol information when performing dst lookups.

Fixes: a25724b05af0 ("Merge branch 'fib_rules-support-sport-dport-and-proto-match'")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Tested-by: Antony Antony <antony.antony@secunet.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:00 +01:00
Eyal Birger
981c319d7f xfrm: extract dst lookup parameters into a struct
[ Upstream commit e509996b16728e37d5a909a5c63c1bd64f23b306 ]

Preparation for adding more fields to dst lookup functions without
changing their signatures.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Stable-dep-of: b84697210343 ("xfrm: respect ip protocols rules criteria when performing dst lookups")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:00 +01:00
Ye Bin
8bc1ed1745 Bluetooth: bnep: fix wild-memory-access in proto_unregister
[ Upstream commit 64a90991ba8d4e32e3173ddd83d0b24167a5668c ]

There's issue as follows:
  KASAN: maybe wild-memory-access in range [0xdead...108-0xdead...10f]
  CPU: 3 UID: 0 PID: 2805 Comm: rmmod Tainted: G        W
  RIP: 0010:proto_unregister+0xee/0x400
  Call Trace:
   <TASK>
   __do_sys_delete_module+0x318/0x580
   do_syscall_64+0xc1/0x1d0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

As bnep_init() ignore bnep_sock_init()'s return value, and bnep_sock_init()
will cleanup all resource. Then when remove bnep module will call
bnep_sock_cleanup() to cleanup sock's resource.
To solve above issue just return bnep_sock_init()'s return value in
bnep_exit().

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:21:59 +01:00