]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.9
authorSasha Levin <sashal@kernel.org>
Sat, 10 Sep 2022 23:50:48 +0000 (19:50 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 10 Sep 2022 23:50:48 +0000 (19:50 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.9/netfilter-br_netfilter-drop-dst-references-before-se.patch [new file with mode: 0644]
queue-4.9/netfilter-nf_conntrack_irc-fix-forged-ip-logic.patch [new file with mode: 0644]
queue-4.9/sch_sfb-also-store-skb-len-before-calling-child-enqu.patch [new file with mode: 0644]
queue-4.9/sch_sfb-don-t-assume-the-skb-is-still-around-after-e.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/tcp-fix-early-etimedout-after-spurious-non-sack-rto.patch [new file with mode: 0644]
queue-4.9/tipc-fix-shift-wrapping-bug-in-map_get.patch [new file with mode: 0644]

diff --git a/queue-4.9/netfilter-br_netfilter-drop-dst-references-before-se.patch b/queue-4.9/netfilter-br_netfilter-drop-dst-references-before-se.patch
new file mode 100644 (file)
index 0000000..941bf92
--- /dev/null
@@ -0,0 +1,96 @@
+From 0e15160384e18d859ab9278f6a8266e2e87598b4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Aug 2022 22:36:03 -0700
+Subject: netfilter: br_netfilter: Drop dst references before setting.
+
+From: Harsh Modi <harshmodi@google.com>
+
+[ Upstream commit d047283a7034140ea5da759a494fd2274affdd46 ]
+
+The IPv6 path already drops dst in the daddr changed case, but the IPv4
+path does not. This change makes the two code paths consistent.
+
+Further, it is possible that there is already a metadata_dst allocated from
+ingress that might already be attached to skbuff->dst while following
+the bridge path. If it is not released before setting a new
+metadata_dst, it will be leaked. This is similar to what is done in
+bpf_set_tunnel_key() or ip6_route_input().
+
+It is important to note that the memory being leaked is not the dst
+being set in the bridge code, but rather memory allocated from some
+other code path that is not being freed correctly before the skb dst is
+overwritten.
+
+An example of the leakage fixed by this commit found using kmemleak:
+
+unreferenced object 0xffff888010112b00 (size 256):
+  comm "softirq", pid 0, jiffies 4294762496 (age 32.012s)
+  hex dump (first 32 bytes):
+    00 00 00 00 00 00 00 00 80 16 f1 83 ff ff ff ff  ................
+    e1 4e f6 82 ff ff ff ff 00 00 00 00 00 00 00 00  .N..............
+  backtrace:
+    [<00000000d79567ea>] metadata_dst_alloc+0x1b/0xe0
+    [<00000000be113e13>] udp_tun_rx_dst+0x174/0x1f0
+    [<00000000a36848f4>] geneve_udp_encap_recv+0x350/0x7b0
+    [<00000000d4afb476>] udp_queue_rcv_one_skb+0x380/0x560
+    [<00000000ac064aea>] udp_unicast_rcv_skb+0x75/0x90
+    [<000000009a8ee8c5>] ip_protocol_deliver_rcu+0xd8/0x230
+    [<00000000ef4980bb>] ip_local_deliver_finish+0x7a/0xa0
+    [<00000000d7533c8c>] __netif_receive_skb_one_core+0x89/0xa0
+    [<00000000a879497d>] process_backlog+0x93/0x190
+    [<00000000e41ade9f>] __napi_poll+0x28/0x170
+    [<00000000b4c0906b>] net_rx_action+0x14f/0x2a0
+    [<00000000b20dd5d4>] __do_softirq+0xf4/0x305
+    [<000000003a7d7e15>] __irq_exit_rcu+0xc3/0x140
+    [<00000000968d39a2>] sysvec_apic_timer_interrupt+0x9e/0xc0
+    [<000000009e920794>] asm_sysvec_apic_timer_interrupt+0x16/0x20
+    [<000000008942add0>] native_safe_halt+0x13/0x20
+
+Florian Westphal says: "Original code was likely fine because nothing
+ever did set a skb->dst entry earlier than bridge in those days."
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Harsh Modi <harshmodi@google.com>
+Acked-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bridge/br_netfilter_hooks.c | 2 ++
+ net/bridge/br_netfilter_ipv6.c  | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
+index 11d4d18012fed..560a36c68be20 100644
+--- a/net/bridge/br_netfilter_hooks.c
++++ b/net/bridge/br_netfilter_hooks.c
+@@ -382,6 +382,7 @@ static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_
+                               /* - Bridged-and-DNAT'ed traffic doesn't
+                                *   require ip_forwarding. */
+                               if (rt->dst.dev == dev) {
++                                      skb_dst_drop(skb);
+                                       skb_dst_set(skb, &rt->dst);
+                                       goto bridged_dnat;
+                               }
+@@ -411,6 +412,7 @@ static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_
+                       kfree_skb(skb);
+                       return 0;
+               }
++              skb_dst_drop(skb);
+               skb_dst_set_noref(skb, &rt->dst);
+       }
+diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
+index 8c08dd07419f6..54dcead37dfd0 100644
+--- a/net/bridge/br_netfilter_ipv6.c
++++ b/net/bridge/br_netfilter_ipv6.c
+@@ -201,6 +201,7 @@ static int br_nf_pre_routing_finish_ipv6(struct net *net, struct sock *sk, struc
+                       kfree_skb(skb);
+                       return 0;
+               }
++              skb_dst_drop(skb);
+               skb_dst_set_noref(skb, &rt->dst);
+       }
+-- 
+2.35.1
+
diff --git a/queue-4.9/netfilter-nf_conntrack_irc-fix-forged-ip-logic.patch b/queue-4.9/netfilter-nf_conntrack_irc-fix-forged-ip-logic.patch
new file mode 100644 (file)
index 0000000..1a2ba79
--- /dev/null
@@ -0,0 +1,43 @@
+From d5b7913315166cae125c1ab672e888c1fecc972b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Aug 2022 14:56:58 +1000
+Subject: netfilter: nf_conntrack_irc: Fix forged IP logic
+
+From: David Leadbeater <dgl@dgl.cx>
+
+[ Upstream commit 0efe125cfb99e6773a7434f3463f7c2fa28f3a43 ]
+
+Ensure the match happens in the right direction, previously the
+destination used was the server, not the NAT host, as the comment
+shows the code intended.
+
+Additionally nf_nat_irc uses port 0 as a signal and there's no valid way
+it can appear in a DCC message, so consider port 0 also forged.
+
+Fixes: 869f37d8e48f ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
+Signed-off-by: David Leadbeater <dgl@dgl.cx>
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nf_conntrack_irc.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c
+index 1972a149f9583..c6a8bdc3a226d 100644
+--- a/net/netfilter/nf_conntrack_irc.c
++++ b/net/netfilter/nf_conntrack_irc.c
+@@ -187,8 +187,9 @@ static int help(struct sk_buff *skb, unsigned int protoff,
+                       /* dcc_ip can be the internal OR external (NAT'ed) IP */
+                       tuple = &ct->tuplehash[dir].tuple;
+-                      if (tuple->src.u3.ip != dcc_ip &&
+-                          tuple->dst.u3.ip != dcc_ip) {
++                      if ((tuple->src.u3.ip != dcc_ip &&
++                           ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) ||
++                          dcc_port == 0) {
+                               net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n",
+                                                    &tuple->src.u3.ip,
+                                                    &dcc_ip, dcc_port);
+-- 
+2.35.1
+
diff --git a/queue-4.9/sch_sfb-also-store-skb-len-before-calling-child-enqu.patch b/queue-4.9/sch_sfb-also-store-skb-len-before-calling-child-enqu.patch
new file mode 100644 (file)
index 0000000..34d022c
--- /dev/null
@@ -0,0 +1,52 @@
+From cf7b41755df3d9ecae73b51943c66aae0f1c0602 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Sep 2022 21:21:36 +0200
+Subject: sch_sfb: Also store skb len before calling child enqueue
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Toke Høiland-Jørgensen <toke@toke.dk>
+
+[ Upstream commit 2f09707d0c972120bf794cfe0f0c67e2c2ddb252 ]
+
+Cong Wang noticed that the previous fix for sch_sfb accessing the queued
+skb after enqueueing it to a child qdisc was incomplete: the SFB enqueue
+function was also calling qdisc_qstats_backlog_inc() after enqueue, which
+reads the pkt len from the skb cb field. Fix this by also storing the skb
+len, and using the stored value to increment the backlog after enqueueing.
+
+Fixes: 9efd23297cca ("sch_sfb: Don't assume the skb is still around after enqueueing to child")
+Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
+Acked-by: Cong Wang <cong.wang@bytedance.com>
+Link: https://lore.kernel.org/r/20220905192137.965549-1-toke@toke.dk
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_sfb.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
+index 592189427a09f..2973d82fb21cc 100644
+--- a/net/sched/sch_sfb.c
++++ b/net/sched/sch_sfb.c
+@@ -281,6 +281,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
+ {
+       struct sfb_sched_data *q = qdisc_priv(sch);
++      unsigned int len = qdisc_pkt_len(skb);
+       struct Qdisc *child = q->qdisc;
+       struct tcf_proto *fl;
+       struct sfb_skb_cb cb;
+@@ -403,7 +404,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
+       memcpy(&cb, sfb_skb_cb(skb), sizeof(cb));
+       ret = qdisc_enqueue(skb, child, to_free);
+       if (likely(ret == NET_XMIT_SUCCESS)) {
+-              qdisc_qstats_backlog_inc(sch, skb);
++              sch->qstats.backlog += len;
+               sch->q.qlen++;
+               increment_qlen(&cb, q);
+       } else if (net_xmit_drop_count(ret)) {
+-- 
+2.35.1
+
diff --git a/queue-4.9/sch_sfb-don-t-assume-the-skb-is-still-around-after-e.patch b/queue-4.9/sch_sfb-don-t-assume-the-skb-is-still-around-after-e.patch
new file mode 100644 (file)
index 0000000..d597d12
--- /dev/null
@@ -0,0 +1,82 @@
+From 709514db8781da4a1d424ae64e3212aff1106cfb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Aug 2022 23:52:18 +0200
+Subject: sch_sfb: Don't assume the skb is still around after enqueueing to
+ child
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Toke Høiland-Jørgensen <toke@toke.dk>
+
+[ Upstream commit 9efd23297cca530bb35e1848665805d3fcdd7889 ]
+
+The sch_sfb enqueue() routine assumes the skb is still alive after it has
+been enqueued into a child qdisc, using the data in the skb cb field in the
+increment_qlen() routine after enqueue. However, the skb may in fact have
+been freed, causing a use-after-free in this case. In particular, this
+happens if sch_cake is used as a child of sfb, and the GSO splitting mode
+of CAKE is enabled (in which case the skb will be split into segments and
+the original skb freed).
+
+Fix this by copying the sfb cb data to the stack before enqueueing the skb,
+and using this stack copy in increment_qlen() instead of the skb pointer
+itself.
+
+Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18231
+Fixes: e13e02a3c68d ("net_sched: SFB flow scheduler")
+Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_sfb.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
+index bc176bd48c026..592189427a09f 100644
+--- a/net/sched/sch_sfb.c
++++ b/net/sched/sch_sfb.c
+@@ -137,15 +137,15 @@ static void increment_one_qlen(u32 sfbhash, u32 slot, struct sfb_sched_data *q)
+       }
+ }
+-static void increment_qlen(const struct sk_buff *skb, struct sfb_sched_data *q)
++static void increment_qlen(const struct sfb_skb_cb *cb, struct sfb_sched_data *q)
+ {
+       u32 sfbhash;
+-      sfbhash = sfb_hash(skb, 0);
++      sfbhash = cb->hashes[0];
+       if (sfbhash)
+               increment_one_qlen(sfbhash, 0, q);
+-      sfbhash = sfb_hash(skb, 1);
++      sfbhash = cb->hashes[1];
+       if (sfbhash)
+               increment_one_qlen(sfbhash, 1, q);
+ }
+@@ -283,6 +283,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
+       struct sfb_sched_data *q = qdisc_priv(sch);
+       struct Qdisc *child = q->qdisc;
+       struct tcf_proto *fl;
++      struct sfb_skb_cb cb;
+       int i;
+       u32 p_min = ~0;
+       u32 minqlen = ~0;
+@@ -399,11 +400,12 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
+       }
+ enqueue:
++      memcpy(&cb, sfb_skb_cb(skb), sizeof(cb));
+       ret = qdisc_enqueue(skb, child, to_free);
+       if (likely(ret == NET_XMIT_SUCCESS)) {
+               qdisc_qstats_backlog_inc(sch, skb);
+               sch->q.qlen++;
+-              increment_qlen(skb, q);
++              increment_qlen(&cb, q);
+       } else if (net_xmit_drop_count(ret)) {
+               q->stats.childdrop++;
+               qdisc_qstats_drop(sch);
+-- 
+2.35.1
+
index 89ee481caea1cc33e0d9f15262e47acb4486818d..218bd113e2d93e1b464870e04e88b640c07ea8f7 100644 (file)
@@ -31,3 +31,9 @@ alsa-aloop-fix-random-zeros-in-capture-data-when-using-jiffies-timer.patch
 alsa-usb-audio-fix-an-out-of-bounds-bug-in-__snd_usb_parse_audio_interface.patch
 scsi-mpt3sas-fix-use-after-free-warning.patch
 driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch
+netfilter-br_netfilter-drop-dst-references-before-se.patch
+netfilter-nf_conntrack_irc-fix-forged-ip-logic.patch
+sch_sfb-don-t-assume-the-skb-is-still-around-after-e.patch
+tipc-fix-shift-wrapping-bug-in-map_get.patch
+tcp-fix-early-etimedout-after-spurious-non-sack-rto.patch
+sch_sfb-also-store-skb-len-before-calling-child-enqu.patch
diff --git a/queue-4.9/tcp-fix-early-etimedout-after-spurious-non-sack-rto.patch b/queue-4.9/tcp-fix-early-etimedout-after-spurious-non-sack-rto.patch
new file mode 100644 (file)
index 0000000..40ffbce
--- /dev/null
@@ -0,0 +1,129 @@
+From 59e8d9442fb628e6d23239f93192fbce3553b6fa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 3 Sep 2022 08:10:23 -0400
+Subject: tcp: fix early ETIMEDOUT after spurious non-SACK RTO
+
+From: Neal Cardwell <ncardwell@google.com>
+
+[ Upstream commit 686dc2db2a0fdc1d34b424ec2c0a735becd8d62b ]
+
+Fix a bug reported and analyzed by Nagaraj Arankal, where the handling
+of a spurious non-SACK RTO could cause a connection to fail to clear
+retrans_stamp, causing a later RTO to very prematurely time out the
+connection with ETIMEDOUT.
+
+Here is the buggy scenario, expanding upon Nagaraj Arankal's excellent
+report:
+
+(*1) Send one data packet on a non-SACK connection
+
+(*2) Because no ACK packet is received, the packet is retransmitted
+     and we enter CA_Loss; but this retransmission is spurious.
+
+(*3) The ACK for the original data is received. The transmitted packet
+     is acknowledged.  The TCP timestamp is before the retrans_stamp,
+     so tcp_may_undo() returns true, and tcp_try_undo_loss() returns
+     true without changing state to Open (because tcp_is_sack() is
+     false), and tcp_process_loss() returns without calling
+     tcp_try_undo_recovery().  Normally after undoing a CA_Loss
+     episode, tcp_fastretrans_alert() would see that the connection
+     has returned to CA_Open and fall through and call
+     tcp_try_to_open(), which would set retrans_stamp to 0.  However,
+     for non-SACK connections we hold the connection in CA_Loss, so do
+     not fall through to call tcp_try_to_open() and do not set
+     retrans_stamp to 0. So retrans_stamp is (erroneously) still
+     non-zero.
+
+     At this point the first "retransmission event" has passed and
+     been recovered from. Any future retransmission is a completely
+     new "event". However, retrans_stamp is erroneously still
+     set. (And we are still in CA_Loss, which is correct.)
+
+(*4) After 16 minutes (to correspond with tcp_retries2=15), a new data
+     packet is sent. Note: No data is transmitted between (*3) and
+     (*4) and we disabled keep alives.
+
+     The socket's timeout SHOULD be calculated from this point in
+     time, but instead it's calculated from the prior "event" 16
+     minutes ago (step (*2)).
+
+(*5) Because no ACK packet is received, the packet is retransmitted.
+
+(*6) At the time of the 2nd retransmission, the socket returns
+     ETIMEDOUT, prematurely, because retrans_stamp is (erroneously)
+     too far in the past (set at the time of (*2)).
+
+This commit fixes this bug by ensuring that we reuse in
+tcp_try_undo_loss() the same careful logic for non-SACK connections
+that we have in tcp_try_undo_recovery(). To avoid duplicating logic,
+we factor out that logic into a new
+tcp_is_non_sack_preventing_reopen() helper and call that helper from
+both undo functions.
+
+Fixes: da34ac7626b5 ("tcp: only undo on partial ACKs in CA_Loss")
+Reported-by: Nagaraj Arankal <nagaraj.p.arankal@hpe.com>
+Link: https://lore.kernel.org/all/SJ0PR84MB1847BE6C24D274C46A1B9B0EB27A9@SJ0PR84MB1847.NAMPRD84.PROD.OUTLOOK.COM/
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Signed-off-by: Yuchung Cheng <ycheng@google.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/20220903121023.866900-1-ncardwell.kernel@gmail.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_input.c | 25 ++++++++++++++++++-------
+ 1 file changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
+index b12a329ef1873..2029e7a36cbb4 100644
+--- a/net/ipv4/tcp_input.c
++++ b/net/ipv4/tcp_input.c
+@@ -2468,6 +2468,21 @@ static inline bool tcp_may_undo(const struct tcp_sock *tp)
+       return tp->undo_marker && (!tp->undo_retrans || tcp_packet_delayed(tp));
+ }
++static bool tcp_is_non_sack_preventing_reopen(struct sock *sk)
++{
++      struct tcp_sock *tp = tcp_sk(sk);
++
++      if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) {
++              /* Hold old state until something *above* high_seq
++               * is ACKed. For Reno it is MUST to prevent false
++               * fast retransmits (RFC2582). SACK TCP is safe. */
++              if (!tcp_any_retrans_done(sk))
++                      tp->retrans_stamp = 0;
++              return true;
++      }
++      return false;
++}
++
+ /* People celebrate: "We love our President!" */
+ static bool tcp_try_undo_recovery(struct sock *sk)
+ {
+@@ -2488,14 +2503,8 @@ static bool tcp_try_undo_recovery(struct sock *sk)
+               NET_INC_STATS(sock_net(sk), mib_idx);
+       }
+-      if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) {
+-              /* Hold old state until something *above* high_seq
+-               * is ACKed. For Reno it is MUST to prevent false
+-               * fast retransmits (RFC2582). SACK TCP is safe. */
+-              if (!tcp_any_retrans_done(sk))
+-                      tp->retrans_stamp = 0;
++      if (tcp_is_non_sack_preventing_reopen(sk))
+               return true;
+-      }
+       tcp_set_ca_state(sk, TCP_CA_Open);
+       tp->is_sack_reneg = 0;
+       return false;
+@@ -2529,6 +2538,8 @@ static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo)
+                       NET_INC_STATS(sock_net(sk),
+                                       LINUX_MIB_TCPSPURIOUSRTOS);
+               inet_csk(sk)->icsk_retransmits = 0;
++              if (tcp_is_non_sack_preventing_reopen(sk))
++                      return true;
+               if (frto_undo || tcp_is_sack(tp)) {
+                       tcp_set_ca_state(sk, TCP_CA_Open);
+                       tp->is_sack_reneg = 0;
+-- 
+2.35.1
+
diff --git a/queue-4.9/tipc-fix-shift-wrapping-bug-in-map_get.patch b/queue-4.9/tipc-fix-shift-wrapping-bug-in-map_get.patch
new file mode 100644 (file)
index 0000000..68aa713
--- /dev/null
@@ -0,0 +1,36 @@
+From fde0c89e913a17ee9c216d37e866a12963d2ed6b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Aug 2022 17:47:56 +0300
+Subject: tipc: fix shift wrapping bug in map_get()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit e2b224abd9bf45dcb55750479fc35970725a430b ]
+
+There is a shift wrapping bug in this code so anything thing above
+31 will return false.
+
+Fixes: 35c55c9877f8 ("tipc: add neighbor monitoring framework")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/tipc/monitor.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
+index e1f4538b16532..7efcbd11a907a 100644
+--- a/net/tipc/monitor.c
++++ b/net/tipc/monitor.c
+@@ -130,7 +130,7 @@ static void map_set(u64 *up_map, int i, unsigned int v)
+ static int map_get(u64 up_map, int i)
+ {
+-      return (up_map & (1 << i)) >> i;
++      return (up_map & (1ULL << i)) >> i;
+ }
+ static struct tipc_peer *peer_prev(struct tipc_peer *peer)
+-- 
+2.35.1
+