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 735D6169AD2; Tue, 16 Jun 2026 18:35:29 +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=1781634930; cv=none; b=i+T6a4GC7k5m0E+N7llBbwuGnSQ3uC5GrxwntwbnAbfAajOxAquxmZloM+o/eOWdJ4FM9MmUSO/jGqABkueMwVVSuHwS3WgHufKWvXZTttnv6mqer9oTjQkfvoqsRHANkqdT5hYE/cXbFgiFSKmf6PrtJ3SPrgcnhq/pYIemuV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634930; c=relaxed/simple; bh=lNyJgAEJqoLBRRMFe6WQ63+oq8dgYBpdyzX3JRRAryE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u/LbWwkz/998ZKBxBq6svmv3ka+5syXsYvruJGyvC6YqPMwkI6SdIznOjqMEtFm8g+MbNsU7sr5JjDw8R8ojRWuZWWe7bd+800UTxdelCoci90kY5KNo5/8pK0Xckoe8eDiKMAVRu7vjE+LAFNCe9WsFxsWSrW8rIWS3l1n5mj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FCL0Ydqg; 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="FCL0Ydqg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52C411F000E9; Tue, 16 Jun 2026 18:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634929; bh=nwrcVrIwjcAcv9PDCcu80vX88mLyFFpz2EoWITgvONw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FCL0YdqgjnLn3+tfpT69q9OnCkgtNc7UoqufHUrNv5oEzKrXjjrZ39fl9FNgQBhfl g0yhbnf6nzLWJ3k/kea6tdsA+VEos0CDBJiQMgnjz1sHmJZNtSlqBiXxadI3LqbN9i vAqCnQJnxBakD9h5uWo1nUojTOSWDBlTuU7dsc/s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Dawei Feng , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 357/411] octeontx2-pf: avoid double free of pool->stack on AQ init failure Date: Tue, 16 Jun 2026 20:29:55 +0530 Message-ID: <20260616145120.299077242@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dawei Feng [ Upstream commit 9b244c242bec48b37e82b89787afd6a4c43457e1 ] otx2_pool_aq_init() frees pool->stack when mailbox sync or retry allocation fails, but leaves the pointer unchanged. Later, otx2_sq_aura_pool_init() unwinds the partial setup through otx2_aura_pool_free(), which frees pool->stack again. The CN20K-specific cn20k_pool_aq_init() implementation has the same bug in its corresponding error path. Set pool->stack to NULL immediately after the local free so the shared cleanup path does not free the same stack again while cleaning up partially initialized pool state. The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc3. Runtime validation was not performed because reproducing this path requires OcteonTX2/CN20K hardware. Fixes: caa2da34fd25 ("octeontx2-pf: Initialize and config queues") Fixes: d322fbd17203 ("octeontx2-pf: Initialize cn20k specific aura and pool contexts") Cc: stable@vger.kernel.org Signed-off-by: Zilin Guan Signed-off-by: Dawei Feng Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260515151826.1005397-1-dawei.feng@seu.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c @@ -1258,11 +1258,13 @@ static int otx2_pool_init(struct otx2_ni err = otx2_sync_mbox_msg(&pfvf->mbox); if (err) { qmem_free(pfvf->dev, pool->stack); + pool->stack = NULL; return err; } aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); if (!aq) { qmem_free(pfvf->dev, pool->stack); + pool->stack = NULL; return -ENOMEM; } }