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 D0FD0274650; Thu, 30 Jul 2026 15:36:57 +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=1785425818; cv=none; b=UJBK5DsJ4yO0HWoIL8tO14wF2aVvumUSa3JG9HmieOTl7oNhL0vODA+tgPg7a2ebsQyjZTzPxQR8zzXrVbgOEirk+PAlum3xeH2G8eaRuOTzavy6TWNxeUD/PyT3Tdq82cOrga4vKq1T5Bhf3qx8WKoDjTQkozFD9JXCV/SR6mc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785425818; c=relaxed/simple; bh=pf3nkOGR7ez2Um3oXtG45WzG9qeGty5kSss41mMuWmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lJCScwp0rBnN8sF3VOycCjSW2BnbA3uHg5QLVGBtymAKEL1IlB2GxEaJ6ACdWGUWysQc6MUJaYmg0r5Wom3lNzyQ2JbAQ31Pn5mgmL7AdGOftTp8bDcamDQ6q1e6XOuQqgn0LBa7PJiaURJk9gjsuDHEfhFc8xrkPV0o6+1Zm2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nBLl0oFB; 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="nBLl0oFB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EA7D1F000E9; Thu, 30 Jul 2026 15:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785425817; bh=fN2+c8aBc4z+n4Wwos0czLfCBIflvJwAMRse5N2eUD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nBLl0oFBKDez9R/joXzznLY3Ot6AkTYT4O1mwzMbTjBGVoWeM/juPL9m6IxVklQbQ thf2PMm9hshvhTG+6upmImYlLodSEGxtjfYb0ureU5KGlsw/oleDS/jEgD9Pg8kyUQ 3/cttCAsNe2yqRox12XxZ3sWbOhXKF1lXbBIwJ4c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, AutonomousCodeSecurity@microsoft.com, "Xiang Mei (Microsoft)" , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 203/602] nexthop: initialize extack in nh_res_bucket_migrate() Date: Thu, 30 Jul 2026 16:09:55 +0200 Message-ID: <20260730141440.223830438@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@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: Xiang Mei (Microsoft) [ Upstream commit 6347c5314cee49f364aaf2e40ff15415a57a116e ] nh_res_bucket_migrate() passes an uninitialized netlink_ext_ack to call_nexthop_res_bucket_notifiers(). When nh_notifier_res_bucket_info_init() fails (e.g. the kzalloc returns -ENOMEM), the error is propagated back before any notifier sets extack._msg, and the error path formats the stale pointer with pr_err_ratelimited("%s\n", extack._msg). With CONFIG_INIT_STACK_NONE this dereferences uninitialized stack memory: Oops: general protection fault, probably for non-canonical address ... KASAN: maybe wild-memory-access in range [...] RIP: 0010:string (lib/vsprintf.c:730) vsnprintf (lib/vsprintf.c:2945) _printk (kernel/printk/printk.c:2504) nh_res_bucket_migrate (net/ipv4/nexthop.c:1816) nh_res_table_upkeep (net/ipv4/nexthop.c:1866) rtm_new_nexthop (net/ipv4/nexthop.c:3323) rtnetlink_rcv_msg (net/core/rtnetlink.c:7076) netlink_sendmsg (net/netlink/af_netlink.c:1900) Kernel panic - not syncing: Fatal exception Zero-initialize extack so _msg is NULL on error paths that never set it. Fixes: 7c37c7e00411 ("nexthop: Implement notifiers for resilient nexthop groups") Reported-by: AutonomousCodeSecurity@microsoft.com Signed-off-by: Xiang Mei (Microsoft) Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260713221551.3344650-1-xmei5@asu.edu Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/nexthop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 52d4890be83e86..ef323775f09acb 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1778,8 +1778,8 @@ static bool nh_res_bucket_migrate(struct nh_res_table *res_table, bool notify_nl, bool force) { struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; + struct netlink_ext_ack extack = {}; struct nh_grp_entry *new_nhge; - struct netlink_ext_ack extack; int err; new_nhge = list_first_entry_or_null(&res_table->uw_nh_entries, -- 2.53.0