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=1795620254; b=SYcPPEh1ZLV+cmJ6XS5KCLpaWUynuO8ZHg/xogF8qopDK6MSTnc7/Ay3jW+FmKeCKa2Y V1VqHEYFO/BpNUUYS6zAlaGHSjuDp9owpZ7vZZrM31qj3YIVuSuEG5G5ZdO7DEz7gNi0f oBeM2vTvF4LlYnHmcINjF1B60XIvdK7V4m40yBdC1J4MS13HCXGI7kjZCAShReJzPMGfN ZM9QD57JsiCzA8I+s/j26FNpjSKPxL/ymGGXnxU47omuFC6/oQ0c7i3LnQT8/0CEl5enX Py9hyKFOFnCdygK7bTL0Y7dGEPEtFaNT2IYeYryDctDfVI+SWl521MoJQnlrYPJLsxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620254; 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=NIVELQ6bSE/pAE79FF7jIjYF9bQxrpNBgLeUUEkVX6Q=; b=govQR700qEfl22IyAOpDnJLI7KV419NmVPGMDLUq4dXgIVZK87D3LjVeljTXvNlQDf1q BZ5IegwBuP/oInxt2mK3IjKjAwlqDJIU4jGXnlUme1yJHpwdwWOhMofyb/HRAoIeVrGbe MvQnQUjXPtdfQjm3hI6WSHZnqa/6g0Qvreq2HozuQZwPIOjG55VE+i5jzozB5uG/ovyMN xL8XzPggswjMnnU/xUDum9PoLXsYBqdpmal4NHn/pfqLnjTQx+WDiqy1GKgkfdjWV+KI1 Qvdt3+tS/adqCuotfJJbvKZIutID+iUXcaKNS0RGEOqVFPWQMrhO47zrRl24g0oiG1g== 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=IilSMo+v; 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 0F70D606A323; Wed, 25 Nov 2026 15:24:14 +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=IilSMo+v Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09D241F000C6; Wed, 25 Nov 2026 15:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795620253; bh=NIVELQ6bSE/pAE79FF7jIjYF9bQxrpNBgLeUUEkVX6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IilSMo+vYYN/jl/E+ujPwVatrhlHF5+jC50ZPbohE9cpEEio3Uzyw/LdmBX/s+XEL SLB4WUiA+nLL1ebkiuaqS+/6YDfoqWZ0q3gEk0vHczlMM5EBw9ilZKeNSPbZJRvnWH PIExVi+E5VyMzjGFL0Z6cwSnwpN26IlDTHRtehko= 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 7.3 0858/1005] dm cache: reject kcopyd client destory if it setup failed Date: Wed, 25 Nov 2026 15:36:36 +0100 Message-ID: <20261125143841.807382428@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@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: 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 @@ -2544,6 +2544,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; }