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=1796388291; b=eeBZdLB5DXcpW0Ebv59ymwb1cFiii8MtYmG+XBit58c5mmXKzclbjOqhGvPOjxL0Gz7R /7Ylk0VqAenAryCv+VqeVuFOovJKWMrdCjPbua1OgfjV8SJQ/s4u+W2xorDOoS+L8qfJj IPdd/o8Vbra/P+xMcR3y9nFb74gaXOmZFeuNPfawXdpbOSOZfQMZRon4SsCGJNg0lbU84 Xrt+z8BWco5KYBVUpaMUf/HnvPtzKyp35e09m1DESjR3KLR8oRRaZNpgkx4wPMKd0eJZu CBZ0KDoU/KHdM+ROpmIauCzVmDY0LRW8MiKIWZ5Or0n49entM6WdhOE9C+xWhOzvBVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388291; 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=BQH+l53i1ioFWG1M8GIaEBBTRrEGwPjyFPpxzkkkxMw=; b=vee0GjVyurUuWseecNqKOIZjI33MutYk4lw0YUIBXFpn/jV0H4WKxM3B0DHAeqvd3xMd Sj0ic8mpFWqEHASifT2fsBG4I98XVufJggcxdDLTB9Oe6HBk6be03esVxqUhO9jVpD3rf boL0b59+iGONhtz6MiDGEThXTeu4BLlAMDVxZdqrqvcNnD+54B4QAei5mi85UAPd09jC8 yHBXJTxBI2ViNxCVv+kCjQ736ZcQy3STt0zemasSvLLZTI5fHHr59QvsmH2+22pZuNmvV xsLtL8c0N8P5nNOhO8+bxOAQ4BlIv7xjLjZi/+MrKxhj79nUiqmnNQhovIMU8OAuJIw== 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=jHTgFWo5; 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 78458606A339; Fri, 4 Dec 2026 12:44:51 +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=jHTgFWo5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C831F00939; Fri, 4 Dec 2026 12:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388291; bh=BQH+l53i1ioFWG1M8GIaEBBTRrEGwPjyFPpxzkkkxMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jHTgFWo59zLonQtUvZclgclxc10ZqMV6CS+txc7PeQGWSt9bCwi8uu80gq0O/8p36 oKizSaH4t1Gss2LeWNxlSI5qQflwiS38Tf3O6vrRKLwm93A/2/3SW+Q2aMWoAM6cBz uppgBQNXDcnIgumV9dNT2ILSNXuBFIXASZHWyD58= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+a2626a25eb2595e3ec3c@syzkaller.appspotmail.com, Edward Adam Davis , Mikulas Patocka Subject: [PATCH 6.1 0559/1059] dm cache: reject kcopyd client destory if it setup failed Date: Fri, 4 Dec 2026 19:01:30 +0900 Message-ID: <20261204100658.657749429@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Edward Adam Davis commit 8b97b168eb4d3affcf23d2980a0c3f35ed9262e2 upstream. The value of cache->copier is -EINTR when failed to create a rescuer kthread for wq kcopyd, in cache_create(), the code jumps directly to __destroy(cache), it merely performs a simple check to see whether copier is NULL, potentially hitting: BUG: KASAN: null-ptr-deref in dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980 Read of size 4 at addr 0000000000000174 by task syz.2.19/6560 Call Trace: dm_kcopyd_client_destroy+0xae/0x480 drivers/md/dm-kcopyd.c:980 __destroy+0x172/0x2f0 drivers/md/dm-cache-target.c:1973 cache_create drivers/md/dm-cache-target.c:2604 [inline] cache_ctr+0x1674/0x2bf0 drivers/md/dm-cache-target.c:2649 dm_table_add_target+0x58d/0xc70 drivers/md/dm-table.c:749 populate_table drivers/md/dm-ioctl.c:1602 [inline] table_load+0x325/0x8a0 drivers/md/dm-ioctl.c:1645 ctl_ioctl drivers/md/dm-ioctl.c:2221 [inline] Set copier to NULL to avoid destroying a invalid kcopy client. Cc: stable@vger.kernel.org Fixes: c6b4fcbad044 ("dm: add cache target") Reported-by: syzbot+a2626a25eb2595e3ec3c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=a2626a25eb2595e3ec3c Signed-off-by: Edward Adam Davis Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-cache-target.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -2552,6 +2552,7 @@ static int cache_create(struct cache_arg if (IS_ERR(cache->copier)) { *error = "could not create kcopyd client"; r = PTR_ERR(cache->copier); + cache->copier = NULL; goto bad; }