From mboxrd@z Thu Jan 1 00:00:00 1970 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 2B221466B77 for ; Thu, 13 Aug 2026 12:11:04 +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=1786623066; cv=none; b=OT2FzwBzygeCoABgEWaeMNyCvpjOYBqmHP/PumkEiZMamRejoE+E38Ced9Nh6OaHx/j4SkaM2bxWdaUzDIOk1GQrtlGnbDVeMcm0zgkv04+Di1QbdcT7ptywbPDjrzqnOnuTXG0xwgfw9CxZ7WjjNDVIYf4BvqOTU1stRL7HWdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786623066; c=relaxed/simple; bh=DTVdeDwfjKVlxHnEAjqujar4nItKz7mzO01SeOPLFZA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eDxnHnyvRwhmpCuBIT+lMoIYnSKnKdlwgZRX1QG0cxE6Rs5Y1wcljUaMhyqL+DrAKKzz/s8LY2gIOSvNkLO9gu/xI8+81KftM1U+gBDDdkguXb4ztt3KNynDU9XhnU6GQ7LyL7SQIK/z54OiSPF7j1prjlu7QgMYjIhZgFfMYEI= 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=YVJlhjOl; 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="YVJlhjOl" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-cbe827e3cb4so2172138a12.3 for ; Thu, 13 Aug 2026 05:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786623064; x=1787227864; 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:content-type; bh=dwDcLt+ekQ9Y5LBz7FQ+yRAyWssdaJWRHh6HLfRkjh4=; b=YVJlhjOlH4PW4YqN80F54wdctzjc2KXmDvpevtkXNplP+/ggA9DsLShf0Wt+Bp1dJh pk+zqF7zSLrYmOoGzIugTeGqgel/iW6qAxVr60LNp+PlhqUOdKDs406IMXV0Uz1Npm8E ONOY5T/w+38A7ryz+sgZF9y0MgIH1cVPtDUYAYCsKQYyZdTpZJdAPjyU/4HGE/0zKa8E hM4CJgS9xgZ87NqjUT9765g8gls5T6znN8mxssiHMrS8ehOpkk9eAH1sjZZTf5fHu7Mm ldqLCwhacBP3TUZUuJs+/02SRh4hEKRBdok1G4q4TUQ59Znnm8onw36IVQQFYj2hGoKy onoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786623064; x=1787227864; 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:content-type; bh=dwDcLt+ekQ9Y5LBz7FQ+yRAyWssdaJWRHh6HLfRkjh4=; b=ACVU5BjChsGzmNtZhsuZbUY6pFtgKk7cPa/S1SsnVTxUcaWV3cKApmkgcLHwZvYFJr WYBNY99SCeTuFfk89qjmIf6IHNEIpvjAGWISwPTyqk7v2Caa79yMSH/7zj44CzKwwruT J2nUtP55frFseod4lE/Z2jVkKRXyRUD6x1QIVolg03Ug2T5OS7U4Y9xI1eB1fFf+TYyo n7L54bBFesc/MDaOTBwgDU8PaQYAYPhInCniXtVXvMD9v2KzQLe3mwMEfVI0a3gfiHez q87RO6C+O7vT7xA6KgKxbHu25Cm0uqElnWQVQePOA+vHbpXVLRbIzbzR2SjdPThzSGgz QImQ== X-Forwarded-Encrypted: i=1; AHgh+RrVpfAc2jynJovRFzyYC47NRiJdzF3ceHkloQ62k42xTTPMmGESzM3mgJkODn/taR1b/ZWdpW9Uo03MWB0=@vger.kernel.org X-Gm-Message-State: AOJu0YyYIWs7Sh/ZnEbf2FDnBRE66VO1R5G3cf32Xv8Q76W8g+jC9OUK PAnwgX4W5b/3RIYJELRNYrhfGtgWG65lRYuHvXzgktkl7rFZPFbN/eZd1/5nnQ== X-Gm-Gg: AR+sD12jBY6BMbfK6v/doz/9aJrCvL+yBYLZmallTFlFCS04Ws4KNp1WrvIk+5TArl6 fXNkbIknuHVYzXLEw+yNOa1xE6W6cKij7tmXpiwJyHcF+gk5Dovz4a22vtuw65kybw7kgBNlkdq pppBrKdN7w25hez79zFttTfH6wdeHns2J8oYB6n6kwPT+iXv83e4LcMondFt2yyFOBD2feyVBu6 T5ZCda+jNXkk3fJ7YFlZGGOELRF4K+fycA7xNFi00lfT8QOH+ofyflRGJa8faVlOabGJs2XBaY/ FLBCkwCxHnjbujVmW2DoL9nxbu9GhekaPuACeo6lusKqrFZXagP+Z3jARfayXYK6wXnTwS2JNaR GDJ1OL5tF/+IgGB5QGUU1VGBvzTKBKQnmmMwy1LvcuZDAS8SdhcG0iSW3IP4XMtBgWLPcSNamfp s0TSdyBl87k+780CP5eDUOsuDcuVYirFUWWKfQo6yccvXZVtWPIDjYyKnGP+jKTVJYJAM+i4HBN u1jCj9AuHcl41fA X-Received: by 2002:a05:6a00:bb0f:b0:848:51b3:f3c2 with SMTP id d2e1a72fcca58-84fc7505093mr4328169b3a.33.1786623064044; Thu, 13 Aug 2026 05:11:04 -0700 (PDT) Received: from SGN-LDSENG.tasernet.com ([2405:4800:5cc3:11a:1ac0:4dff:fe8b:4a69]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84fc5a935cdsm776434b3a.56.2026.08.13.05.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2026 05:11:03 -0700 (PDT) From: Cong Nguyen To: Greg Kroah-Hartman Cc: Martyn Welch , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] staging: vme_user: fix flush_image leak in tsi148 bridge Date: Thu, 13 Aug 2026 19:10:57 +0700 Message-Id: <20260813121057.2590433-1-congnt264@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When error checking is enabled (err_chk=1), tsi148_probe() allocates an extra master window resource, tsi148_device->flush_image, which is used to flush posted writes by reading back over the VME bus. Unlike the regular master windows, this resource is not linked into tsi148_bridge->master_resources. Because it is not on any resource list, it is freed neither by the probe error path (which only walks the master_resources list) nor by tsi148_remove(), so it is leaked whenever err_chk is set and either probe fails after the allocation or the device is unbound / the module is unloaded. Free flush_image in both the probe error path and tsi148_remove(). This is safe when err_chk is disabled: tsi148_device is allocated with kzalloc() so flush_image is NULL and kfree(NULL) is a no-op. Fixes: d22b8ed9a3b0 ("Staging: vme: add Tundra TSI148 VME-PCI Bridge driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4 Signed-off-by: Cong Nguyen --- Changes in v2: - Add Assisted-by: tag (Greg Kroah-Hartman). No code changes. drivers/staging/vme_user/vme_tsi148.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index c695ad9b4ca2..8ee1e00cef4f 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -2513,6 +2513,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) list_del(pos); kfree(master_image); } + kfree(tsi148_device->flush_image); tsi148_irq_exit(tsi148_bridge, pdev); err_irq: @@ -2619,6 +2620,8 @@ static void tsi148_remove(struct pci_dev *pdev) kfree(master_image); } + kfree(bridge->flush_image); + iounmap(bridge->base); pci_release_regions(pdev); -- 2.25.1