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 CA8081C5F25; Wed, 19 Mar 2025 14:39:08 +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=1742395148; cv=none; b=ZfrECr/LO9k/fRRR0iF8cf4Oi998W1W66zljJqRE27/HICNFkVwmRJcLyMmMLk6AqaI9uhQBYLEYmS5n5IYM97lM9K3PFudkcyFEp80vOIMFwbAn5KDIQaVM2qveaJumFj2mI7arkvOfP3obp65Pn0q1xHmMXXJljqm7IsVC0og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395148; c=relaxed/simple; bh=tPyG8UphfJ+hzgRMDnkCDoaZvpPkjijoGlJZQELDoBE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R/TJvdi6BMXJQEVAOeqXhUQHq3N0urLTdL9zv9qCycF5OzbBJS1fXGIUN4OqiySXL2UwuBz3MIeM+/IcTV2eGl9zrbcgKu5bPa3Ht5Ye0PGni2pZOc8ujjPtoFOcJC1b5bj78lwdL8wvGzVcjHaPiA3tWZ1h8OtaEYfQ10XUDVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VinOaJB+; 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="VinOaJB+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BBD1C4CEE4; Wed, 19 Mar 2025 14:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742395148; bh=tPyG8UphfJ+hzgRMDnkCDoaZvpPkjijoGlJZQELDoBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VinOaJB+XCDpC9hKuPtFwAqUAOVNmFuF1SIhu2k3QodE19FFjWL/Bzuc/YP6DngxY fYogbv2qYACyKSeBJJ3l73rSJqAWHfQcjIoq9RRHjqiGiyuVQD5ngF04+/7V8IWScK ydSzgXTEKdnHiCcKVczbM5hk8SK1XbC+Rgz9VDb8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christophe JAILLET , Andi Shyti , Sasha Levin Subject: [PATCH 6.12 221/231] i2c: ali15x3: Fix an error handling path in ali15x3_probe() Date: Wed, 19 Mar 2025 07:31:54 -0700 Message-ID: <20250319143032.299818503@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250319143026.865956961@linuxfoundation.org> References: <20250319143026.865956961@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe JAILLET [ Upstream commit 6e55caaf30c88209d097e575a169b1dface1ab69 ] If i2c_add_adapter() fails, the request_region() call in ali15x3_setup() must be undone by a corresponding release_region() call, as done in the remove function. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Christophe JAILLET Signed-off-by: Andi Shyti Link: https://lore.kernel.org/r/9b2090cbcc02659f425188ea05f2e02745c4e67b.1741031878.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-ali15x3.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 4761c72081022..418d11266671e 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c @@ -472,6 +472,8 @@ MODULE_DEVICE_TABLE (pci, ali15x3_ids); static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) { + int ret; + if (ali15x3_setup(dev)) { dev_err(&dev->dev, "ALI15X3 not detected, module not inserted.\n"); @@ -483,7 +485,15 @@ static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) snprintf(ali15x3_adapter.name, sizeof(ali15x3_adapter.name), "SMBus ALI15X3 adapter at %04x", ali15x3_smba); - return i2c_add_adapter(&ali15x3_adapter); + ret = i2c_add_adapter(&ali15x3_adapter); + if (ret) + goto release_region; + + return 0; + +release_region: + release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); + return ret; } static void ali15x3_remove(struct pci_dev *dev) -- 2.39.5