From patchwork Sun Nov 5 19:56:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maciej_=C5=BBenczykowski?= X-Patchwork-Id: 13446090 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D521C1642B for ; Sun, 5 Nov 2023 19:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c08CcNAb" Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7615BDD for ; Sun, 5 Nov 2023 11:56:04 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-da0cb98f66cso4380756276.2 for ; Sun, 05 Nov 2023 11:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699214163; x=1699818963; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:mime-version :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=QUArnjSIsgXrx7xFAxQVER0QA0qRV6AYyhVWnbMzG4g=; b=c08CcNAbZ4pdFhebIO69rhezM3/YJmSlSR4tGE7uLaV+BqGl/3L7zcIbhkbb6Rzn53 S+wpclAvdGp+ha5ffB+RGFzDbFP6UHY7Mr1GpZq61YCJaQNdJ+iIaUzVe32mR6eXC0n3 HGylq5QV6PZEOEJDsWb6mZgCg7w1cpzuLge6r5JCoQLL1O1mIb6zwe+kspI35fJF757B 8v5t7qq82WpCzoAitb0AUQCGdYvvhycy4zoHuh9rgBYfiBgNChgtF9zASAke1oEtngNE FKwaRZH5eBuju/HXtClcH8r+foRir1Sk/7X64ywU5IY45k7UnBgk/HmOs+9oSMwDhyJd WwAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699214163; x=1699818963; h=content-transfer-encoding:cc:to:from:subject:mime-version :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QUArnjSIsgXrx7xFAxQVER0QA0qRV6AYyhVWnbMzG4g=; b=nf3XysQD26YpwN7XffiOANK5y2HxFm7MjS5wLQCryUBtiYpq0QWTFEXefuB1/EJvrv 3kfxp0zCS6jheJHLCIHPuWkcPynVTOBV5cW8xqBeC7+O9dE5mIDVorFbRe8SkZHo7Zxp wJE7V+PB3ELJresu4p0ZEBrMOmy4sm0XAAQM5UR1gPGaU83xhhLRHqBrKG0N7fxtBd76 OMsXh+7EW46aVmDa3dHw63Z4Ag/3K4rx+Ltl1OEycIy3/xXfpl1+2pid4oenk8p7vXom dzz3XMi+75A/tcZ9nYv/xeCx86ZSYjQrmvZdvXEqskzj1R+piAlvAMvPVz4jweGdPi3/ UcKw== X-Gm-Message-State: AOJu0YxKx4VoVjMvVxYZ7MPXLPV3V4D1Ec2bSTGiBb7W0jEWJgxSaAWY Njqur97chh7qZirxqtpXE9QFo9Hd X-Google-Smtp-Source: AGHT+IFwPAe+YxrftLkpjJj6/uUQsA+ztDwXxVSaYNAZQh9aXwwqjfQlklUxAnhkE+1HsBMjtAcoLzXM X-Received: from athina.mtv.corp.google.com ([2620:15c:211:200:8452:1b9c:f000:45a5]) (user=maze job=sendgmr) by 2002:a25:8806:0:b0:da0:ca6a:bdad with SMTP id c6-20020a258806000000b00da0ca6abdadmr558919ybl.10.1699214163628; Sun, 05 Nov 2023 11:56:03 -0800 (PST) Date: Sun, 5 Nov 2023 11:56:00 -0800 Message-Id: <20231105195600.522779-1-maze@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog Subject: [PATCH net v2] netfilter: xt_recent: fix (increase) ipv6 literal buffer length From: " =?utf-8?q?Maciej_=C5=BBenczykowski?= " To: " =?utf-8?q?Maciej_=C5=BBenczykowski?= " , "David S . Miller" , Pablo Neira Ayuso , Florian Westphal Cc: Linux Network Development Mailing List , Netfilter Development Mailing List , Jan Engelhardt , Patrick McHardy X-Patchwork-Delegate: kuba@kernel.org From: Maciej Żenczykowski in6_pton() supports 'low-32-bit dot-decimal representation' (this is useful with DNS64/NAT64 networks for example): # echo +aaaa:bbbb:cccc:dddd:eeee:ffff:1.2.3.4 > /proc/self/net/xt_recent/DEFAULT # cat /proc/self/net/xt_recent/DEFAULT src=aaaa:bbbb:cccc:dddd:eeee:ffff:0102:0304 ttl: 0 last_seen: 9733848829 oldest_pkt: 1 9733848829 but the provided buffer is too short: # echo +aaaa:bbbb:cccc:dddd:eeee:ffff:255.255.255.255 > /proc/self/net/xt_recent/DEFAULT -bash: echo: write error: Invalid argument Cc: Jan Engelhardt Cc: Patrick McHardy Fixes: 079aa88fe717 ("netfilter: xt_recent: IPv6 support") Signed-off-by: Maciej Żenczykowski Reviewed-by: Simon Horman --- net/netfilter/xt_recent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 7ddb9a78e3fc..ef93e0d3bee0 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c @@ -561,7 +561,7 @@ recent_mt_proc_write(struct file *file, const char __user *input, { struct recent_table *t = pde_data(file_inode(file)); struct recent_entry *e; - char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; + char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255")]; const char *c = buf; union nf_inet_addr addr = {}; u_int16_t family;