From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B6E9C43F4D2; Thu, 30 Jul 2026 14:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421286; cv=none; b=sDyQwNXWNTxPiic3RWhMfayGoxt/N5I6r9l9MuW2/+W5QY0QHsV/wVHkae7xHKgfZdkZj/G6p6a2x24KBZdaKaGRKEToxYjLOHBJW06ICjozs9P2QT/GTDf4PSkvSpH6P6J1eyMJGG1hHwKG/y9SAfsYSrrgArO6Kr/LCMphu44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421286; c=relaxed/simple; bh=ODv3/tcsJ0VGAOC/ROgS0pOhXy4sRbqHPg3vB7nLuHE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NCQEl2AMHwmzLQn7zEdCxeEZB/adI0aQv/X+6kqPobJ6DhKV58tUD84lFnyJx586SOgyH7ag6GsvGPO+DRV53aKS7elrcXf+VU+UWJbrQSxmdqYADKtjrYvaTUO2AScDCG6HqBI92B4gouzB6ZkXGW9D85Sj8s/M/kBWncXvHCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aSyUUcw4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aSyUUcw4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 373FD1F000E9; Thu, 30 Jul 2026 14:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785421281; bh=RepqfY4Q7TZdYTgjbhq0rddWI4uDRU8danw7oOIcQXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aSyUUcw4HYgRFyf5qF79h+D23hU8WHU9rGX21NiY9qGFqUQM7P1l1RXtBrfxRxKjR SD8u/ZAPQ48pI5SpdJqwpCBujpkVfylNTBASY7okAZFpIVSh3WnEWbO8uOXr5crRR0 cmvrBUpVmj4ic/Rf+FM2zjwEHTmXAZ5bn6d3RUnk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Johannes Berg , Sasha Levin Subject: [PATCH 7.1 051/744] wifi: ipw2100: fix potential memory leak in ipw2100_pci_init_one() Date: Thu, 30 Jul 2026 16:05:24 +0200 Message-ID: <20260730141445.364755735@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141444.267951807@linuxfoundation.org> References: <20260730141444.267951807@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal [ Upstream commit 0d388f62031dbabcba0f44bb91b59f10e88cac17 ] The memory allocated in the ipw2100_alloc_device() function is not freed in some of the error paths in ipw2100_pci_init_one(). Fix that by converting the direct return into a goto to the error path return. The error path when pci_enable_device() fails cannot jump to fail, since at this point priv is not set, so perform error handling inline. Fixes: 2c86c275015c ("Add ipw2100 wireless driver.") Signed-off-by: Abdun Nihaal Link: https://patch.msgid.link/20260620065242.93798-1-nihaal@cse.iitm.ac.in Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c b/drivers/net/wireless/intel/ipw2x00/ipw2100.c index c11428485dccf5..2b8a23865bfb29 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c @@ -6157,6 +6157,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, if (err) { printk(KERN_WARNING DRV_NAME "Error calling pci_enable_device.\n"); + free_libipw(dev, 0); + pci_iounmap(pci_dev, ioaddr); return err; } @@ -6169,16 +6171,14 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, if (err) { printk(KERN_WARNING DRV_NAME "Error calling pci_set_dma_mask.\n"); - pci_disable_device(pci_dev); - return err; + goto fail; } err = pci_request_regions(pci_dev, DRV_NAME); if (err) { printk(KERN_WARNING DRV_NAME "Error calling pci_request_regions.\n"); - pci_disable_device(pci_dev); - return err; + goto fail; } /* We disable the RETRY_TIMEOUT register (0x41) to keep -- 2.53.0