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=1796381322; b=g2LJW66qzLfv94QBvyEMMLbFqcXtfwS4NbZ5zWW9iwaUHcjJ5VJWZROtlNXDDeDpF94a fl+Gn7rENjGhJb2GmLonP36cTzH72OpMozsjFJL2qa40xBadKaTmRkPqspVXrFqprsse6 EhvKB+0945ZfxfTJj1sawUsp/vcQsJP8HGY7fJKU/gfge5dMxjHHVjQVZXO/h7iDZkl0e EhUjmlgHf8o2rlghRM+5ZdGpLp7KgBilOGqmvWas1dL9KSoYbZAqr/DNpwwrY0bm69ALg teSdJyXzO+FpzSGmwFKBKiZvVCvMlAP28on6l135mtS5aR3K4rgdb9ysFS+tzuqqEgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381322; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=qvje8nJy8QFm3/9l2CdNHnE1W+jbwSKNcCcpgkQVmV8=; b=DjuzEzCqNT99KqIM56ETeZNlWUhjZmXq+EO9/xge2Cb19+LkQKtbIx1l5qXen3t8W1Yq XcGA6Nbz49bxR4JHJIiEHI8fhEP73wpWzdV7f8LM+u3WzW0oRU0wTZGR6nthEBuglpbq+ tb72R1I82ZtysmqlsuC+lH/csbVzndP3OnAXmHpB5tvm7g+5jBOJOyi5Svn6YOS6HrBG7 nwWZKYKywhNCKZiIU2q5UNeHLNx1yFhYENwf3GUSOMlvGWoqyJnXSyBbAPtjgVm8FsX3Q G9JD9z6Q+hSAT7O+3pQbJEOeCa9mn1fPdV0mBfMmhBGkLnIe/DMO2gHWtE1/nbeJfYA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2dWFQwFC; 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 01FBF606A322; Fri, 4 Dec 2026 10:48:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2dWFQwFC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71E271F000C2; Fri, 4 Dec 2026 10:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381321; bh=qvje8nJy8QFm3/9l2CdNHnE1W+jbwSKNcCcpgkQVmV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2dWFQwFCMYgq7JUt5gS5m2oW5my5Ee4Bss3yOCAivMZEsg5NCPcpCA8JxivjwXm3Y u731OBIO0c/2taptxZc7RKPnLlib+dCioUwBWB7/L7LnovCauia+S2b55Q1Pbm3gyt axpZouG8W4AWrIdyy4L678+3tfe+BrKTuSNxg7bM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shao Mingyin , "Martin K. Petersen (Oracle)" Subject: [PATCH 7.3 652/742] scsi: target: Fix NULL pointer dereference in target_dev_alua_lu_gp_store() Date: Fri, 4 Dec 2026 19:08:36 +0900 Message-ID: <20261204100652.406584870@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shao Mingyin commit fe5988e8708e1d42cb844bd9ac8f0a51388061fc upstream. Writing "NULL" to the alua_lu_gp attribute clears the ALUA LU group association of a device. The attribute can be written again after the association has already been cleared. In that case lu_gp_mem->lu_gp and lu_gp_new are both NULL, but the code still calls __core_alua_attach_lu_gp_mem(), which dereferences the NULL lu_gp pointer: BUG: kernel NULL pointer dereference, address: 0000000000000000 ... __core_alua_attach_lu_gp_mem target_dev_alua_lu_gp_store Clearing an already cleared association is a no-op, so return early when there is no association left to clear. Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Signed-off-by: Shao Mingyin Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261026194955694FnXGoQ352dstLk5HPBqCG@zte.com.cn Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/target/target_core_configfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -2547,6 +2547,14 @@ static ssize_t target_dev_alua_lu_gp_sto spin_lock(&lu_gp_mem->lu_gp_mem_lock); lu_gp = lu_gp_mem->lu_gp; + if (!lu_gp && !lu_gp_new) { + /* + * The LU group association has already been cleared, so + * there is nothing left to do. + */ + spin_unlock(&lu_gp_mem->lu_gp_mem_lock); + return count; + } if (lu_gp) { /* * Clearing an existing lu_gp association, and replacing