From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (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 E89DB38D6A8 for ; Tue, 18 Aug 2026 01:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787018013; cv=none; b=OWs7qy7F1rLNaABdokifRMRkXEpeCgtt5FYmLh8W4gpikJ2CTAShlXqFQVi4lrBv1coB0OS2/lGbuIpuxNXMy1NfGkFxUJGfGuXl4hK+JkfH2lTScCdSE6IaOQdeV2751IlwEQm3FqTamUhzNcpw97voCV1v60I6RsMweLBetaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787018013; c=relaxed/simple; bh=N/+1jPrgZ5VgGFa0qKn90pe7O/GOkIdTuhyDvoqhNjY=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=uT7ErnFhkk1AdcZvKzTsEsYUJ/RmQ457k3EyZneusUx0cX5PGjnM/NdWNa9ZJRZwy3qsq9QPeJSzsUrYEz4uN8gpuIkj9aL9hJCR7rQMu1PvYykiXX1jh6I0YD8Z10CPwwe9USg0x8rRReB0PZK1p7fvDE9eSYPNNDWjJ5sPWr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.167.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-4a7c64fbbc6so5396119b6e.2 for ; Mon, 17 Aug 2026 18:53:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787018011; x=1787622811; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=oh7/2tjHjyZffIMscomdAk1zrFfiibxYhz1X02FWJcs=; b=DyFxgjgMhYtT2lvXeSBSoFEHak5W+3mGtFWfHO4negwFZ6MZGtZS6XXmop7achqrRQ /bYKHcbWjBqe1swWhTtmbkPL8sS1vFz9LCCZQTk0C49VP6Xh184geKfyfU+Hq3jbJTM9 ZPqdbXwFCFbiicGm/GXABHniPILXTUcK8glg2CiMryFGwwkv61VeVq08Oe6fTaiJ1Fgq nScOkqPIG+nt7VYkBuCreMKNBP9FoJZGsk1lcu8Qu3uWKi2oSojTYKeR3nOMDVP98q1B K2sSyAnO57KMkv6sJiPa4tHno4k1qBaPxDIYM0jogR8uSFlu2DidF8DpyxVT/X21Lhl7 KI/w== X-Gm-Message-State: AOJu0YwgGRaIv7IkT5QWUsPlMPHuGUBDn9UF5AV5Jy3qlNZpwZmJbAay F6JEv3qeg2v57c1TLSZBhRvfjEJwtKFny3iTt71ESIR0zpcbQJ6oTFvWrJwaaneICAhPaXPZcS2 aBLo9WeuWDBTx1wzFk4WDhMMkyr+anSclrqU+WGtmtpuZ2JLJgY02lvjZa64= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6808:c2fa:b0:4b2:8d89:6a40 with SMTP id 5614622812f47-4b2975bc6a4mr5313704b6e.7.1787018010946; Mon, 17 Aug 2026 18:53:30 -0700 (PDT) Date: Mon, 17 Aug 2026 18:53:30 -0700 In-Reply-To: <6a833819.4d75e56a.c9a88.0001.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a83bb1a.dbb3a75c.20434b.0080.GAE@google.com> Subject: Forwarded: [PATCH] iommufd: Fix NULL deref of area->pages in ioas_change_process From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] iommufd: Fix NULL deref of area->pages in ioas_change_process Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master Areas are inserted into the area_itree before area->pages is assigned, so an area with a NULL pages pointer is briefly visible to readers. iommufd_ioas_change_process() walks every area and dereferences area->pages unconditionally, which oopses when racing with a concurrent IOMMU_IOAS_MAP_FILE. Reject the racing case with -EBUSY, matching how iopt_unmap_iova_range() handles the same window. Checking in the first loop covers the whole function since all iova_rwsems are held for write across the call. Reported-by: syzbot+48637757323884de77a2@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=48637757323884de77a2 Signed-off-by: Deepanshu Kartikey --- drivers/iommu/iommufd/ioas.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/iommufd/ioas.c b/drivers/iommu/iommufd/ioas.c index fed06c2b728e..71bffece84b5 100644 --- a/drivers/iommu/iommufd/ioas.c +++ b/drivers/iommu/iommufd/ioas.c @@ -535,6 +535,10 @@ int iommufd_ioas_change_process(struct iommufd_ucmd *ucmd) return rc; for_each_ioas_area(&ioas_list, index, ioas, area) { + if (!area->pages) { + rc = -EBUSY; + goto out; + } if (area->pages->type != IOPT_ADDRESS_FILE) { rc = -EINVAL; goto out; -- 2.34.1