{"id":2224497,"url":"http://patchwork.ozlabs.org/api/1.2/covers/2224497/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/cover/cover.1776429882.git.mnencia@kcore.it/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<cover.1776429882.git.mnencia@kcore.it>","list_archive_url":null,"date":"2026-04-17T13:24:35","name":"[v2,0/2] PCI: Guard Resizable BAR restore against unreachable devices","submitter":{"id":93088,"url":"http://patchwork.ozlabs.org/api/1.2/people/93088/?format=json","name":"Marco Nenciarini","email":"mnencia@kcore.it"},"mbox":"http://patchwork.ozlabs.org/project/linux-pci/cover/cover.1776429882.git.mnencia@kcore.it/mbox/","series":[{"id":500338,"url":"http://patchwork.ozlabs.org/api/1.2/series/500338/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500338","date":"2026-04-17T13:24:35","name":"PCI: Guard Resizable BAR restore against unreachable devices","version":2,"mbox":"http://patchwork.ozlabs.org/series/500338/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2224497/comments/","headers":{"Return-Path":"\n <linux-pci+bounces-52723-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=kcore.it header.i=@kcore.it header.a=rsa-sha256\n header.s=spark header.b=tQHRpFbO;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-52723-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=kcore.it header.i=@kcore.it header.b=\"tQHRpFbO\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=49.13.27.68","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=kcore.it","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=kcore.it"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxwbS6pm4z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 23:24:52 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 47FDC302BE51\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 13:24:49 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7878E34E74B;\n\tFri, 17 Apr 2026 13:24:46 +0000 (UTC)","from spark.kcore.it (spark.kcore.it [49.13.27.68])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 215E52949E0;\n\tFri, 17 Apr 2026 13:24:45 +0000 (UTC)","from mnencia by spark.kcore.it with local (Exim 4.96)\n\t(envelope-from <mnencia@kcore.it>)\n\tid 1wDjBV-007w6C-18;\n\tFri, 17 Apr 2026 15:24:37 +0200"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776432286; cv=none;\n b=sJZpToF7U1/ER7JfcS2es1TL7fFCgUyIG8wPQTBXDoZGGJWZrFw1Zr17G6iLihpgJl8LjPmvSwuyhVK2/TIhTl8kr2BeTRWWGyopNdlxlhKmzQJmpos7OYFoIOdhrEuSMiu6bvRgDr4BTfOr9yq2dnurZgCr0UscarPY6O00yOk=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776432286; c=relaxed/simple;\n\tbh=t3tJ+SAiGCi2KvgrmBY3Rqk5TNtkUO8KrlAYautdR7c=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=AJpRv8CTmtMN6E+O8wD6V76t+DrO19s+ZULfP+AXXRKPcFc9aFNJFyqIiwcPZswbaPxXWhWXaP0j0Yr40NJ6SEvtTwj8n37i+NbR/j0EhHmn182V7MASZBza+tNZpglxAnBfFdEvxtfpxkmVCqdWlIWSWGYjx5S8MmQgJrMjFHk=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=kcore.it;\n spf=pass smtp.mailfrom=kcore.it;\n dkim=pass (1024-bit key) header.d=kcore.it header.i=@kcore.it\n header.b=tQHRpFbO; arc=none smtp.client-ip=49.13.27.68","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kcore.it;\n\ts=spark; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:\n\tMessage-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=Lzd3+dPt+cxg2OfNmx9stohUnV0gbXlmu4x9ZXeTZXA=; b=tQHRpFbOLAry2rQzz0GJcln4fY\n\tGxHsy27IirpuDL0zTinC/OvzusvM5sqGVJszWVQLk5oW2umg7NPqotstmHa+I9wHFqRnse9IQUd9j\n\tqMpN0DOHqotI356LpesCmOYFm7d3aqS6FMIAqZF4/BxwUtFamYe+36T/uhYJjiEzytOc=;","From":"Marco Nenciarini <mnencia@kcore.it>","To":"Bjorn Helgaas <bhelgaas@google.com>,\n\tlinux-pci@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org,\n =?utf-8?q?Christian_K=C3=B6nig?= <ckoenig.leichtzumerken@gmail.com>,\n Marco Nenciarini <mnencia@kcore.it>","Subject":"[PATCH v2 0/2] PCI: Guard Resizable BAR restore against unreachable\n devices","Date":"Fri, 17 Apr 2026 15:24:35 +0200","Message-Id":"<cover.1776429882.git.mnencia@kcore.it>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20260408163922.1740497-1-mnencia@kcore.it>","References":"<20260408163922.1740497-1-mnencia@kcore.it>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"This series addresses Bjorn's review feedback on v1 [1].\n\nv1 bounds-checked bar_idx before indexing dev->sriov->barsz[] in\nsriov_restore_vf_rebar_state(). Bjorn pointed out that the non-SRIOV\nsibling pci_restore_rebar_state() has the same issue, and that a\nPCI_POSSIBLE_ERROR(ctrl) check on the config read makes the intent\nof the guard more obvious than a post-hoc range check on the\nextracted field.\n\nv2 therefore adopts PCI_POSSIBLE_ERROR(ctrl) after each Resizable\nBAR Control read in both functions, bailing out when config reads\nreturn the all-ones pattern. Patch 1 covers pci_restore_rebar_state().\nPatch 2 covers sriov_restore_vf_rebar_state(), with the NVIDIA GC6\nUBSAN splat as motivation.\n\nNote that this changes behavior versus v1: on a bad read we abort\nthe loop instead of skipping just the current BAR. This matches\nthe structure Bjorn suggested in review and is safe because the\nall-ones pattern means the device is unreachable, so restoring the\nremaining BARs is moot.\n\nCompile-tested on pci/next (full drivers/pci/ build). The error\npath cannot be exercised without reproducing the GC6 failure that\nkilled the GPU in the original report.\n\nThe broader v1 discussion on the pci_restore_config_dword() retry\nloop and on save/restore behavior when the device has fallen off\nthe bus is out of scope for this fix. Happy to tackle that\nseparately if there is consensus.\n\n[1] https://lore.kernel.org/all/20260408163922.1740497-1-mnencia@kcore.it/\n\nMarco Nenciarini (2):\n  PCI: Skip Resizable BAR restore on read error\n  PCI/IOV: Skip VF Resizable BAR restore on read error\n\n drivers/pci/iov.c   | 6 ++++++\n drivers/pci/rebar.c | 6 ++++++\n 2 files changed, 12 insertions(+)\n\n\nbase-commit: 40286d6379aacfcc053253ef78dc78b09addffda"}