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 225871DE8AE; Sun, 7 Jun 2026 10:09:05 +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=1780826946; cv=none; b=H+kzLG5J0nOueBFroTl57djYBB2sWoWCpKt5Ehid7NwhQgpieVGuxAnduw0UMilEoHzKJdcFPaa0sKeKVIUrz+I5aiTED+nm4m7h6Z7br2sZMHZypckpdYcPNcnfSxK9utqs8nm200KldL8FUNt3KBPqmDB3WFlnPpe+NFRMTyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780826946; c=relaxed/simple; bh=1lq8xOdqdOWMyxqf7Y4b4UHok+pz6FFB27chkr6kQU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D2hGOKfr9aRjbstw3ipog6c6WZy8aBN4aTm/WOUYz86mFfViKZFnni1ndlDN63nvkChC/YyF1kCfPixz4raw4kWmSEnG0uYxvMgbkfvXcQ6jb5W0sGcUQ5Yd3ScG0BVtHuFqULAgYbKqSsl5xyGWzfP59OOLQQiYd/9z4SFMbQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=U3isWmm4; 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="U3isWmm4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 327821F00893; Sun, 7 Jun 2026 10:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780826945; bh=wY3RZJP3EhM8KPzvb0TQg4HIZzvDEggJ2YbFCsFkpJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=U3isWmm4ar906pUKjj6FGt4Z8CE19FTWT+cm3Z2Zp87ZFGC8FSM4oYLjCJC1GDbSU 66uiQiE+HbFvNt0YPWvJIyg1cNILEZuF4j4g/p/1ayETonhJGRgj0rW7gSTuRUabux mdIMO8kSlLZCBBkhb1VGda/NmKeQvfiH4n8BZ4fU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Halil Pasic , Alexandra Winter , Mahanta Jambigi , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 025/315] net/smc: Do not re-initialize smc hashtables Date: Sun, 7 Jun 2026 11:56:52 +0200 Message-ID: <20260607095728.417705921@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandra Winter [ Upstream commit 9e4389b0038781f19f97895186ed941ff8ac1678 ] INIT_HLIST_HEAD(&smc_v*_hashinfo.ht) are called after smc_nl_init(), proto_register() and sock_register(). This can lead to smc_v*_hashinfo.ht being reset even though hash entries already exist and are being used, possibly resulting in a corrupted list. Remove unnecessary and dangerous re-initialisation of smc_v*_hashinfo.ht in smc_init(); it is implicitly initialised to zero anyhow. Add HLIST_HEAD_INIT to the definitions for clarity. Fixes: f16a7dd5cf27 ("smc: netlink interface for SMC sockets") Suggested-by: Halil Pasic Signed-off-by: Alexandra Winter Acked-by: Halil Pasic Reviewed-by: Mahanta Jambigi Link: https://patch.msgid.link/20260521145639.10317-1-wintera@linux.ibm.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/smc/af_smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 5915fcdef743d2..21d0c62bcf4644 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -188,10 +188,12 @@ static bool smc_hs_congested(const struct sock *sk) struct smc_hashinfo smc_v4_hashinfo = { .lock = __RW_LOCK_UNLOCKED(smc_v4_hashinfo.lock), + .ht = HLIST_HEAD_INIT, }; struct smc_hashinfo smc_v6_hashinfo = { .lock = __RW_LOCK_UNLOCKED(smc_v6_hashinfo.lock), + .ht = HLIST_HEAD_INIT, }; int smc_hash_sk(struct sock *sk) @@ -3595,8 +3597,6 @@ static int __init smc_init(void) pr_err("%s: sock_register fails with %d\n", __func__, rc); goto out_proto6; } - INIT_HLIST_HEAD(&smc_v4_hashinfo.ht); - INIT_HLIST_HEAD(&smc_v6_hashinfo.ht); rc = smc_ib_register_client(); if (rc) { -- 2.53.0