From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DA602318B9B for ; Mon, 4 May 2026 08:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884787; cv=none; b=AFUQdG9AqpiRzU3iM//LtfG/5Ks3+tK5V3FpchmPVr5u/jegw5MIZMUyd79JrTa0aEZNPkX+z6gAX1bHs9tRT+V+V982rFVNGwvRvvfTQdc+/E6fZdO9MbwnWKUZxcqoBO6Y0uyrnYpcvgpNxf1m74XYJAGHZgvNr+r+tbWIbwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884787; c=relaxed/simple; bh=mkt8wP5+qjKkrBsGzbSf5YWQGclZVDpXBgrvNzOqLRE=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=COPsjZaRlxfirjDilKVvD7OtBR6Ur7Eatyultq67KsRrMkHzbDrCcTCZl+Q25GTd2AbY55clsCTDqHzA26o3IVeVcF1V2NuKYOPT0T7h1GkLdLRLQhj+H2nf7u4LR4rYZf451n8G20sZyMdVmm4uZXrpD9NEabQTYvOc4xRzHTI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RtNd5Mji; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RtNd5Mji" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31E13C2BCB8; Mon, 4 May 2026 08:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777884787; bh=mkt8wP5+qjKkrBsGzbSf5YWQGclZVDpXBgrvNzOqLRE=; h=Subject:To:Cc:From:Date:From; b=RtNd5MjiJiAaMcmcssA9Earw7nOhUocCNhSwNaM0iZN7xF3ar2+04Z0+c4sfDeawS IAk0cqcBz3cQfmJuiDGnHYBJA3C+6p0HHWfsWd6TKVCZjm/1bxgDAqjb146kHFs9+5 ubgPjzJW7ryvpSXxAYKeZ/zn/bu+B3zZKkl0L1Hk= Subject: FAILED: patch "[PATCH] scsi: sd: fix missing put_disk() when device_add(&disk_dev)" failed to apply to 5.10-stable tree To: yangxiuwei@kylinos.cn,john.g.garry@oracle.com,martin.petersen@oracle.com Cc: From: Date: Mon, 04 May 2026 10:52:57 +0200 Message-ID: <2026050457-liability-regular-cc7c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 1e111c4b3a726df1254670a5cc4868cedb946d37 # git commit -s git send-email --to '' --in-reply-to '2026050457-liability-regular-cc7c@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1e111c4b3a726df1254670a5cc4868cedb946d37 Mon Sep 17 00:00:00 2001 From: Yang Xiuwei Date: Mon, 30 Mar 2026 09:49:52 +0800 Subject: [PATCH] scsi: sd: fix missing put_disk() when device_add(&disk_dev) fails If device_add(&sdkp->disk_dev) fails, put_device() runs scsi_disk_release(), which frees the scsi_disk but leaves the gendisk referenced. The device_add_disk() error path in sd_probe() calls put_disk(gd); call put_disk(gd) here to mirror that cleanup. Fixes: 265dfe8ebbab ("scsi: sd: Free scsi_disk device via put_device()") Cc: stable@vger.kernel.org Reviewed-by: John Garry Signed-off-by: Yang Xiuwei Link: https://patch.msgid.link/20260330014952.152776-1-yangxiuwei@kylinos.cn Signed-off-by: Martin K. Petersen diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 205877b1f8aa..adc3fa55ca2c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -4061,6 +4061,7 @@ static int sd_probe(struct scsi_device *sdp) error = device_add(&sdkp->disk_dev); if (error) { put_device(&sdkp->disk_dev); + put_disk(gd); goto out; }