* [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry
@ 2023-02-09 12:58 Igor Artemiev
2023-02-09 15:07 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Igor Artemiev @ 2023-02-09 12:58 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Igor Artemiev, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam, netdev, linux-kernel, lvc-project
When both --remove and --update flag are specified, there's a code
path at which the entry to be updated is removed beforehand,
that leads to kernel crash. Update entry, if --remove flag
don't specified.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
Fixes: 404bdbfd242c ("[NETFILTER]: recent match: replace by rewritten version")
---
net/netfilter/xt_recent.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 7ddb9a78e3fc..189a413aa9d8 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -315,7 +315,8 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par)
}
if (info->check_set & XT_RECENT_SET ||
- (info->check_set & XT_RECENT_UPDATE && ret)) {
+ (info->check_set & XT_RECENT_UPDATE && ret &&
+ !(info->check_set & XT_RECENT_REMOVE))) {
recent_entry_update(t, e);
e->ttl = ttl;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry
2023-02-09 12:58 [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry Igor Artemiev
@ 2023-02-09 15:07 ` Florian Westphal
2023-02-09 16:09 ` Jan Engelhardt
0 siblings, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2023-02-09 15:07 UTC (permalink / raw)
To: Igor Artemiev
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, coreteam, netdev, linux-kernel, lvc-project
Igor Artemiev <Igor.A.Artemiev@mcst.ru> wrote:
> When both --remove and --update flag are specified, there's a code
> path at which the entry to be updated is removed beforehand,
> that leads to kernel crash. Update entry, if --remove flag
> don't specified.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
How did you manage to do this? --update and --remove are supposed
to be mutually exclusive.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry
2023-02-09 15:07 ` Florian Westphal
@ 2023-02-09 16:09 ` Jan Engelhardt
2023-02-09 20:17 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2023-02-09 16:09 UTC (permalink / raw)
To: Florian Westphal
Cc: Igor Artemiev, Pablo Neira Ayuso, Jozsef Kadlecsik,
netfilter-devel, coreteam, netdev, linux-kernel, lvc-project
On Thursday 2023-02-09 16:07, Florian Westphal wrote:
>Igor Artemiev <Igor.A.Artemiev@mcst.ru> wrote:
>> When both --remove and --update flag are specified, there's a code
>> path at which the entry to be updated is removed beforehand,
>> that leads to kernel crash. Update entry, if --remove flag
>> don't specified.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
>How did you manage to do this? --update and --remove are supposed
>to be mutually exclusive.
I suppose the exclusivity is only checked at the iptables command-line
and neverwhere else.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry
2023-02-09 16:09 ` Jan Engelhardt
@ 2023-02-09 20:17 ` Florian Westphal
0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2023-02-09 20:17 UTC (permalink / raw)
To: Jan Engelhardt
Cc: Florian Westphal, Igor Artemiev, Pablo Neira Ayuso,
Jozsef Kadlecsik, netfilter-devel, coreteam, netdev,
linux-kernel, lvc-project
Jan Engelhardt <jengelh@inai.de> wrote:
> On Thursday 2023-02-09 16:07, Florian Westphal wrote:
>
> >Igor Artemiev <Igor.A.Artemiev@mcst.ru> wrote:
> >> When both --remove and --update flag are specified, there's a code
> >> path at which the entry to be updated is removed beforehand,
> >> that leads to kernel crash. Update entry, if --remove flag
> >> don't specified.
> >>
> >> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >
> >How did you manage to do this? --update and --remove are supposed
> >to be mutually exclusive.
>
> I suppose the exclusivity is only checked at the iptables command-line
> and neverwhere else.
Removing the userspace check gives me an -EINVAL from checkentry.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-09 20:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 12:58 [lvc-project] [PATCH] netfilter: xt_recent: Fix attempt to update removed entry Igor Artemiev
2023-02-09 15:07 ` Florian Westphal
2023-02-09 16:09 ` Jan Engelhardt
2023-02-09 20:17 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).