From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796482970; b=uTLBw2ePDz9R1fWZe+B8+Xl9e9rNbmM22pmdKLY9B5oYsfBxCIaBCVjiyhg72sHUX7H5 QHoxl8uJvLq1+luAqTGICuj4qw2UxtUsv4yzaHD3ANz4Sx0e+J2R8EU6r03qi0jnslPX1 713xkVnmvEDCNwEKmcc8urm/O8JTZbu8Wf4iz5b21G9wzG4ZNHqO/DK3hHe4vfMQnk3eD +jDowNWNnESTLkcdGaCKX5Y0ZV83brsJx/3mQs4hkxfqfFkWL2+50ak/9iTEKCtLFRKr2 zNwWAllHo9OgOaFm1T3olkFqgKu4JMFRfnFLft8YV1kE7n5QAxyieLo9HVOikLlQEPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796482970; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=/EsV4D8TjGdbmajzBmdgI2g2aIscChEaO3y+V1PZBhk=; b=FdeGhajWVEqefPEXG66Y5dIdtz2ntVFRJDno8kLSDKQ6UVZbibb2AMIMEvkH6MT8M3Yd ChAKq+jwrpQXzq6ddJWbAKAxpiMW2nWiLiqLzEsYeyHqwS/wG4gJNSkmBL4fHDhtOVR3m Nq/9HDUiJ6pnV3m52+TyBlFQJBm3csAR7ums+VNT9ouEFWtZwryToB1bqszo9d4arLe0G DG1Cv5ArjVdmgmQ55qwDAyZsprJfjFuMAX4pWnWJvvR62RQACmPhlcmP1vieuNra4uK7j eFZyx+J5uATUDambWgoDTpuHiOY/7OrEOc8D+o/5I0C2BnIipqKhZoYRpIA7Hs1PpVw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BGCwqdsN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09781606A322 for ; Sat, 5 Dec 2026 15:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BGCwqdsN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC701F00936; Sat, 5 Dec 2026 15:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796482969; bh=/EsV4D8TjGdbmajzBmdgI2g2aIscChEaO3y+V1PZBhk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=BGCwqdsNwD0iuOifFawfpzoMS/42nWvurik17Jq0uHggPNawzcoR0ddwggiRtYLs5 TlUwaUs1tavOGwKw56D+GOhw0C1I/+gPHWDXw0QRLXmMex7NHrXNJqeJ7AofdqTjHl Jj4ysUDRCWD2evDc/FOMDjKCO14jU3ViMRKv3bcgN7LPfdt/VRloDYldLQ64N+1Y+i V4pura4lJwVZ+YKASFRreG6WVqy1zZ5MwN5rebj8hEtQDLYV96lgsC42NnS+59VMo4 Wyq8nTMAMtg+gprrFLuVupX7sR7ql/aicGgf8kgT6OvqBCT/MjNPqhlgy8HajLx73I BMge1VZCDSMUA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] RDMA/bnxt_re: clear sq->swq pointer on error in bnxt_re_setup_qp_swqs() Reply-To: sashiko-reviews@lists.linux.dev To: "Yuansheng Yang" <0xbeac@gmail.com> Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261205145220.1712012-1-0xbeac@gmail.com> References: <20261205145220.1712012-1-0xbeac@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 15:02:49 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > In bnxt_re_setup_qp_swqs(), which only runs for kernel QPs > (!qplqp->is_user; user QPs return early at the top of the function), if > rq->swq allocation fails when !qplqp->srq after sq->swq has already been > allocated, the error path frees sq->swq via kfree(sq->swq) without > resetting sq->swq to NULL. >=20 > Both callers, bnxt_qplib_create_qp1() and bnxt_qplib_create_qp(), destroy > the firmware QP and propagate the error back to bnxt_re_create_qp(), > whose free_hwq unwind label calls bnxt_qplib_free_qp_res(). Because > qp->sq.swq is still non-NULL, bnxt_qplib_free_qp_res() calls > kfree(qp->sq.swq) a second time on the already-freed buffer: >=20 > BUG: KASAN: double-free in bnxt_qplib_free_qp_res > Call Trace: > kfree > bnxt_qplib_free_qp_res > bnxt_re_create_qp >=20 > Clear sq->swq to NULL after freeing it in bnxt_re_setup_qp_swqs() so > subsequent cleanup via bnxt_qplib_free_qp_res() is safe. >=20 > Fixes: 13f9a813eee5 ("RDMA/bnxt_re: Refactor bnxt_qplib_create_qp() funct= ion") > Cc: stable@vger.kernel.org > Signed-off-by: Yuansheng Yang <0xbeac@gmail.com> Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205145220.1712= 012-1-0xbeac@gmail.com?part=3D1