From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (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 88BDE3F58EF for ; Thu, 11 Jun 2026 12:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781181137; cv=none; b=sAfphSrfikirdW0cHXk64bNQP/OJ5IlEe8buJCayuhqU2NclscHhvd/52HBmeGmQ7tjLIP+g6QQYR+CLPzoWLX56eV+wbYx82z8fVKfPMUHJJ84SMCr7HG8GWaOxmsBfE+U2GLL12cWsG6Y3/b8lpqcN8mJYwrHK6Z8QutLtOg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781181137; c=relaxed/simple; bh=5jAwKvcQVAYHQgGBdOtHn5dcMMi9Yqbb8REDi0+fask=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gVfIHBa2R/7PAPvAwyjSkBG+N6sjAKFVacYJa8tL3fEfGozD0WdLCGMNEOdVo0nX2TyyPy5oEU2Fb6RSD0BtBaEC6F1/ouSz3c7dH0bsN0c5ad31sCi3QBR3mb5B62PT3oGVuAVi7eHUeJliIj1CO9gQJU/h7p73S95goku+xOY= 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=X7q9MN0f; arc=none smtp.client-ip=209.85.222.51 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="X7q9MN0f" Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-9618b8bdc51so2165941241.1 for ; Thu, 11 Jun 2026 05:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781181135; x=1781785935; 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; bh=hGPUMpfdaDQCNkNjTMnCmLU/jdnRUY0BJXqb4atgwFI=; b=X7q9MN0frNfh5Do4XeEoxBux4ykD7skkI7f2pljGpOoeD98xIKatArR3IHBBRnJwZ7 m3gyS28pPcsgjgSdKs4+YcVXYdmzdwhfOW/CN7u8Dzt39gGeXL/t04mP2b3yQGUTpPi0 +gpmIl3jh7UHhibSKzvBj8hmXl8zCOVi39ryOM922EyqmrKZMVWbAJ1r2Wjm4EIZHa3Q AG8yb3jsNjL0AkZ4E7cR7jazyPRIbU2S770xCUB+8dK5hni6NmMJzNAygofAtuPtJqRK bi10g754xtWupfkxaANM49DovnPwuzRbamKcYAbyMMctg+Tw1FDXB4wIeLYaUYR9g+qv Uc+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781181135; x=1781785935; 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; bh=hGPUMpfdaDQCNkNjTMnCmLU/jdnRUY0BJXqb4atgwFI=; b=BISIbfqDFOtQbtcu7w5VHzvtcz8OOlh67rh+/uPp6AjZfSibsIK5wmA0cmEBtPgML1 jlyPbzA3rxPV0e3mHmmht7PgTGP0z3n9nuYgCY8Vgx7nbucLdV5Ykwd+hGaxXkhYKyik mrSp7CTpEa4wLkHehkV4ZS/+BdNBcJ40EshNhGn1VSG2zoUXwMCyfaG7beM1rM/uvBKs lpiBiMj8UZxucYq6IsoN+uF7cwePIgIY4vqnkiBRWxQIHRnaXjJKIXJtlD8HU9dLzoYl AoQWSlQH9iXnHuYzc6JgCpv2XEweyxIYPzbhXws/1L82ffIR2Pkl/tBNg1gG5jfREjOz VS0g== X-Forwarded-Encrypted: i=1; AFNElJ/TMhIuAydNRJapCznXd4t/SpFNzm/hdwsyZjCm4NRJDes5mlMq3o1P9r0jKPJ+3rPuvP52/hEruv79WAg=@vger.kernel.org X-Gm-Message-State: AOJu0YxQ8DqnyYdXo1D2rJzYVnoKbphAFONaI7HAG8dj2YCAJwdS0iMx N9cgqhYxLz31WWuyAba+iza2VeZktb0yZYmApt5FJo1JEPkv9zlEkdUo X-Gm-Gg: Acq92OETLHiNM3RDJPAUyIQaOqLcZDq4jUBD9G1wKMJVabeEan79wPv4kwiNQ0Wt1yV rqNmK0INN9ad0JPHgXCWOqtWuL0elC3RPeOW5jm+Eom/mVqoQeKF5xUthwER3GuyTzo+ioV3wsn s/8OHwuG3r9NIuc2aE3ZVzAWYEuTlvrS708mIWBhoe0yE+1nOhojH72lq81Q1DlzUrsod4v6nb1 7YAS2VTKkBLeVBiy1I0WiUqAHnuJbxa3N1mtefYc2kukqXh8K6iSisnGUox7RHf3f19Pi65p9iK Gass6Mt6oS9l6vmfptCQFWx3qhzB1FboK733ukr1Z9GhDkmsnyVcMj9yMVntU3n/nmZepLHe9+2 qlsfTjdtteYkNcGe6leQG/pc8VytGY5S7XJAiW0cUSvrQ+TlUDfKu0wPi+bY45v4sINcwtuKigl juCGC3BYDQBSIUtKA4ATQZ0Jj3Hlahs4AEeA5PnCZChO7tJd5XzorZf3sOc6prPWPnPgyi8Lgk+ zPhsCUCjbFcwr7oLmCGYRd9ZAN0da+/ATnQI7HybA== X-Received: by 2002:a05:6102:442c:b0:6c2:e290:cc75 with SMTP id ada2fe7eead31-71d5989b9demr795299137.4.1781181135386; Thu, 11 Jun 2026 05:32:15 -0700 (PDT) Received: from server0 (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9160b02f758sm171220685a.36.2026.06.11.05.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 05:32:14 -0700 (PDT) From: Michael Bommarito To: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] xen/scsiback: fix command-tag handling on pre-completion error paths Date: Thu, 11 Jun 2026 08:30:44 -0400 Message-ID: <20260611123046.2323342-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit scsiback_get_pend_req() hands a pvSCSI frontend request a session tag and a zeroed se_cmd. Two error paths that run before the command completes through the target core mishandle that command and leak (or, in one case, underflow) the tag. Impact: a pvSCSI guest can exhaust a LUN's per-session command tag pool, stopping the LUN, via crafted ring requests; for the first case the refcount underflow also panics the host under panic_on_warn. Patch 1 fixes scsiback_do_cmd_fn(): on a failed grant map and on an unknown request type the never-initialised command (cmd_kref == 0) is freed with transport_generic_free_cmd(), which underflows the zero refcount and leaks the tag. Patch 2 fixes scsiback_device_action(): when target_submit_tmr() fails the err: path frees nothing. transport_generic_free_cmd() cannot be used there either, since the command is initialised by then and se_tmr_req has already been freed on one error sub-path. Both paths go through one helper that returns just the tag. Patch 1's underflow was reproduced on a Xen dom0 (guest to host, with a panic_on_warn host panic); with the series applied the same request is handled with no underflow. Michael Bommarito (2): xen/scsiback: free unsubmitted command instead of double-putting it xen/scsiback: free the command tag on the TMR submit-failure path drivers/xen/xen-scsiback.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8 -- 2.53.0