From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 558DA47045A; Tue, 21 Jul 2026 19:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663002; cv=none; b=EgMc19XRa5Aw+GGoimsvlLAxVHK4wkQOcqfr2vMFkstgKebVFzdQSy6cpUDKIlcylFH1AqPMAXo7hXxisqywe5m72khNOQVdxccALGTUVydOodzlGa2DWnsnfwVxji8jZNBBXUfh9ibztmbmfA1EWa+gL2e6rGavLh8UBxNMEtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663002; c=relaxed/simple; bh=DzxCfRz7IjqyAFlRGKfcSY3+hAfNYA8PHjZZb02nowc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p7PesMOpYApTz5vBnYGCLZv8tDuS2bKk6L9pdhjaRbZy3rfmoz85+q2GWILT8MTYNRlmfHISPoi0UPud9FsLU1BUJV4F2BW7NoEBRKMFTgG0uoWbdzSRn8dFitKJlvA25mQAE9cPljW1MlCDgpX/HX8sb24BUgOidadvTmgjLto= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=r89rYi6q; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="r89rYi6q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D0C1F000E9; Tue, 21 Jul 2026 19:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663001; bh=84LUn3v6yBK+YG44mXHhVHDEOM+oeIh9BPVgDRm+LOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r89rYi6quYTMoG+hHdvwxAW01/qjQv/6uqsEzXslwzRPcjFajisFsbff6ToA7GE2M UJKBiXfIMng1qP3sqZy5mHFw2mx2dMdOEnR5vbYAOrdhKHvuXUqp9KtHNdNeezXcD1 WQN86tbTQv0cq3xV68iJn55coGu63sDEXD2vFLG0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nicolas Dichtel , Fernando Fernandez Mancera , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 0659/1276] ipv6: fix error handling in forwarding sysctl Date: Tue, 21 Jul 2026 17:18:22 +0200 Message-ID: <20260721152500.854806868@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fernando Fernandez Mancera [ Upstream commit 058b9b19f9639fe1e1225a17c540f61b65bee6ad ] When writing to the forwarding sysctl, if proc_dointvec() fails to parse the input, it returns a negative error code. The current implementation is overwriting that error for write operations. This results in a silent failure, it returns a successful write although the configuration was not modified at all. When modifying the "all" variant it can also modify the configuration of existing interfaces to the wrong value. Fix this by checking the return value of proc_dointvec() and returning early on failure. In addition, adjust return code of addrconf_fixup_forwarding() for successful operation. Fixes: b325fddb7f86 ("ipv6: Fix sysctl unregistration deadlock") Reviewed-by: Nicolas Dichtel Signed-off-by: Fernando Fernandez Mancera Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260622130857.5115-4-fmancera@suse.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/addrconf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d9684be8ec0753..7b65f150b72cc5 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -907,7 +907,7 @@ static int addrconf_fixup_forwarding(const struct ctl_table *table, int *p, int if (newf) rt6_purge_dflt_routers(net); - return 1; + return 0; } static void addrconf_linkdown_change(struct net *net, __s32 newf) @@ -6362,6 +6362,8 @@ static int addrconf_sysctl_forward(const struct ctl_table *ctl, int write, lctl.data = &val; ret = proc_dointvec(&lctl, write, buffer, lenp, ppos); + if (ret) + return ret; if (write) ret = addrconf_fixup_forwarding(ctl, valp, val); -- 2.53.0