From nobody Wed Jun 17 07:29:35 2026 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3545D39B94F for ; Mon, 27 Apr 2026 08:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777278317; cv=none; b=IU0U4Wrv0SfimQ9z/2CBfCvenojCgW7LhKnGatPl+o726Oi7VCL6YY2Ps8KmEwAey2+zEPt2cbJhjv3XbqS9WZRr4IdozDWmrONq+kbswjwTFWoBMR2p0QKAc4OtaWQJoVs0j3NuDbNLXq7DTQRuarMJXV+UFWWliRP3nrWCffg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777278317; c=relaxed/simple; bh=+BrxlxfOQEye4Vs5yOHMMdR6wuvIizqlVvEMpg8Bk6Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sIRKNG40ftsZxnK0XCHutAq9pShTCyGhtF2QYoNHpyAGudseKAoYZA/7dl1/QSa06V6Zp5xpwW6CWQQz+jiJmQcwWeoqyQ6RPffk5IY4fOuqdNZLChmmoKq7MGrSK3IEwrYssZcgrIAmWCGI99Dn5WkO+ovHNAKY6whpEyAwDAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=oO6+L7C1; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oO6+L7C1" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-c76bde70ec9so3888555a12.2 for ; Mon, 27 Apr 2026 01:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777278315; x=1777883115; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=h/eapNxKO0qx5JN/Z8Jc8SYx7RZsmKzmHix+3vMH/gk=; b=oO6+L7C1awxsA8pvfcBGfDtHOwXk1XqGHqFwx/Qza/Qp06gqzJw0AwVfPpDaw/d9PO OO1ZTLI/O5Il3v0o9RP9/CIm0kcMiDB8x6wrEOIEnlO7esTC7nyUpetFlryB1PiglVkz DKS6bC4H0N2P2i5hAcQrpydu4+6cW2HIeC+FjndTxPPPN7i4RRRKZ6+5JVckkdKhivzG uQM3cP/tbX/yxemAQLLyQ+YfYbnFTX3A9TFQd2yZLytpCFglXGHP35ldKUCAshqpqX1E Hs2V02N1NI/F81cPYI/2xvlzSt0yV/xNeErqjfKrTPsBHql3JlEtTtpHYzbp2aLSTRqS 3umQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777278315; x=1777883115; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h/eapNxKO0qx5JN/Z8Jc8SYx7RZsmKzmHix+3vMH/gk=; b=OtAf8MOv8YSRSgrTe6nbL18JPKm2X/93i3nB6TClrqokmQG8F3iqbj6vWsS/6erUr3 rHevLWsvAOX1eTgU7hPa+q6xiWW4QnFqsE8tg07cXreznUqegSAA9yAlV90zRuQ6quWC qjneiLTbpCl5SHl9nEU9RlCavSZELUhevWNBGLtxP4vwFlNQUpNNzu+NSSseCYNGPw7S cehDpAt2l+OXu3RpKb+KiFEqKW9jXPzWA1+uBHk3Cxc9a3vI+vNgDcAe6XpE6g0213bv wY/CrpTg51Y4meK3S2D+57Ijm8Nu4z4TsvJ09eoJAc2bP2XFtoDCB4H2XWA/sA/g5B4u eKJg== X-Forwarded-Encrypted: i=1; AFNElJ9s1I+JAWU/6+W3DLVnf+K57gQf5MvvlueA6neXoHClUQAdqYFk46KuRSWOOxF9wvcanbIOizWVNHXjViU=@vger.kernel.org X-Gm-Message-State: AOJu0YwZlnftP/mg+T45HY1oAkuL3dNi+VH3eGhNNdG1D6lSHsgbwYu+ YmGa9tb53MiUTorEt2tWaaokq5CPyh2PH14n1StO/zQjpPc5k7/NXlk= X-Gm-Gg: AeBDievD3o7oLB98I5Rkm/OM32yrj0e106xRb0VrGZbdNLtSZyaMpD6mYnNdWuVzSVb LsZP5RLOC8rnjVC6GGtLYH75RCNZhMjchAjWQwb87Ioo9uIKXum69Z12be1krzbMsFW9mRUPVc5 oh2w68jvbMJPB2rrIwKjopDyweNNl2XGpZ1bkxZyH6BWcKS8iHJDZsvh5XQRUJLVWXdSCZavv0W q0EyS1qCXotx+joFntfwdrIenYhmnKF6wPnMTmsgHNOUDM2jrPpc/JqqDoMKHQ+Spqva+MJmWH+ VXvLRjgE7K6LVZrHRTKwuy5Xtwkb7/HXCKtgi0owJQTniQDQrUqb4r5T1VXeeDO9hZUURhGp8ql CU/pbjdYuPmVWQQBEC2ToWsg7ABoiLhkbnhT8oqN/1nKWkNlKBjYsxrAVuoeTwUwj79Jzu1Vyew dEu+oWB9NGQk6HH6uCYD5fohljti+btozHL3wPxvPCkH0IoSJXrkgjrKKVTtxLWujJAuo/QzeXV Qw3n75fXeHqMBm/zheD8xyDbU2eiIL6Yh7Sri9bfxfcDtk= X-Received: by 2002:a05:6a20:72a3:b0:39b:d6e0:2d4 with SMTP id adf61e73a8af0-3a08d8fec06mr50644047637.48.1777278315508; Mon, 27 Apr 2026 01:25:15 -0700 (PDT) Received: from localhost.localdomain ([1.226.165.54]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c797702fbfcsm24036858a12.22.2026.04.27.01.25.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Apr 2026 01:25:15 -0700 (PDT) From: "=?UTF-8?q?=EB=B0=95=EB=AA=85=ED=9B=88?=" X-Google-Original-From: =?UTF-8?q?=EB=B0=95=EB=AA=85=ED=9B=88?= To: "James E.J. Bottomley" , "Martin K. Petersen" , Ijae Kim Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Myeonghun Pak Subject: [PATCH] scsi: pcmcia: sym53c500: Fix probe error cleanup Date: Mon, 27 Apr 2026 17:24:52 +0900 Message-ID: <20260427082505.57719-1-pakmyeonghun@bagmyeonghun-ui-MacBookPro.local> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Myeonghun Pak SYM53C500_config() calls SYM53C500_release() from its early failure path even though those failures can happen before a SCSI host has been allocated and stored in link->priv. SYM53C500_release() unconditionally dereferences info->host and then tears down a fully registered host, so the probe error path can dereference a NULL host instead of unwinding only the resources acquired so far. Use pcmcia_disable_device() on configuration failures and let SYM53C500_probe() free the per-device allocation when configuration fails, because the driver's remove callback is not called after a failed probe. Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functio= ns") Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/scsi/pcmcia/sym53c500_cs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53= c500_cs.c index 1530c1ad5d..95a001c16a 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -800,12 +800,12 @@ SYM53C500_config(struct pcmcia_device *link) err_free_scsi: scsi_host_put(host); err_release: - release_region(port_base, 0x10); + pcmcia_disable_device(link); printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n"); return -ENODEV; =20 failed: - SYM53C500_release(link); + pcmcia_disable_device(link); return -ENODEV; } /* SYM53C500_config */ =20 @@ -845,6 +845,7 @@ static int SYM53C500_probe(struct pcmcia_device *link) { struct scsi_info_t *info; + int ret; =20 dev_dbg(&link->dev, "SYM53C500_attach()\n"); =20 @@ -856,7 +857,13 @@ SYM53C500_probe(struct pcmcia_device *link) link->priv =3D info; link->config_flags |=3D CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; =20 - return SYM53C500_config(link); + ret =3D SYM53C500_config(link); + if (ret) { + kfree(info); + link->priv =3D NULL; + } + + return ret; } /* SYM53C500_attach */ =20 MODULE_AUTHOR("Bob Tracy ");