Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 C897A330B3A for ; Fri, 20 Feb 2026 12:05:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589133; cv=none; b=WRJeTxybL1LIGPrE8O7XiSEgkjd6X1q3EX/q7QolPt3Pepx/5+fC0kLoJYa2keOAI9DrIlq5EBhr6nV0Vo5OWupwRgpqDWa7n6z7Kvgju5KuCMyX3CIUc9ysXSiGY0wVHS4RXQYvmai165asgoBM1J8mV0Zp1kYVA5eb+bjKxMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771589133; c=relaxed/simple; bh=d6KIfm8i4N5/94DwJjV055cP9k5cfz0EcxQWmUtKEI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SPXlTD8x+4pqodf+FnlECkKm8buevUArkrF6u31sF1TweUmEPoJyfsrkQCnmigxHUx8Qg1VF+CFqQtx0Hitau85U/zG2nsDD/83/IzN0lnIXGH7RTcxC34DdHa6z0WDyPhYS3OzXJ8njgeAAdZK1weAt/k8joPmEcxSGk2AUeNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=NnEywvYf; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="NnEywvYf" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZWO7x8SU2CZDn3BEaZK+tZ+lsVVO+Bc0SxYQXOzl1FE=; b=NnEywvYfm+8aQC6O/V81Q+RP9d op0gG8OxV12tJAcj4vTVpaW0uwY5wF/Wi9eLOUTQq6IsOCvWefgkqm1lTva+0BPWGo51gPFM2GCZJ gwo4w2o1RDX+Vw5+EF2C8ZUYVgh280/2Yduwl53+oAxgVzLEu8iQdf42bnIeEitpOrPBBvSCJKlls H45Kfy2/yod0vjfoTWuFllwgiHTsWxso4GDONsjUzIsfXx2IDR2ZabjbJ540KyXuKKNDIHJH980NI zrCut2WybTKcmkHkJgqr69LewHQvq+OzbXflbvJt2/WgfFFow6ik4hA6/oaQrVCGIyJNaXXNVglQB O5nMnfWg==; Received: from [90.240.106.137] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vtPGE-002uyz-U4; Fri, 20 Feb 2026 13:05:30 +0100 From: Tvrtko Ursulin To: criu@lists.linux.dev Cc: David Francis , Tvrtko Ursulin Subject: [RFC 08/26] plugins/amdgpu: Close dma-buf image file if the read fails Date: Fri, 20 Feb 2026 12:04:56 +0000 Message-ID: <20260220120514.4540-9-tvrtko.ursulin@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> References: <20260220120514.4540-1-tvrtko.ursulin@igalia.com> Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Consolidate to one fclose() call with the extra bonus the inconsequential file descriptor leak is eliminated. Signed-off-by: Tvrtko Ursulin --- plugins/amdgpu/amdgpu_plugin_dmabuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin_dmabuf.c b/plugins/amdgpu/amdgpu_plugin_dmabuf.c index 11c9792e3649..93a975e16e83 100644 --- a/plugins/amdgpu/amdgpu_plugin_dmabuf.c +++ b/plugins/amdgpu/amdgpu_plugin_dmabuf.c @@ -120,6 +120,7 @@ int amdgpu_plugin_dmabuf_restore(int id) } ret = read_fp(img_fp, buf, img_size); + fclose(img_fp); if (ret) { pr_perror("Unable to read from %s", path); xfree(buf); @@ -130,10 +131,8 @@ int amdgpu_plugin_dmabuf_restore(int id) if (rd == NULL) { pr_perror("Unable to parse the dmabuf message %d", id); xfree(buf); - fclose(img_fp); return -1; } - fclose(img_fp); /* Match GEM handle with shared_dmabuf list */ fd_id = amdgpu_id_for_handle(rd->gem_handle); -- 2.52.0