From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.197 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796002404; b=l485+3MBUdUHXo+0tnXcqPN+y6TLPgFEwGoF14mXkN8nsCYQSCPUeK+KV7dBEOu/b/+Z CaQq3su1tRhPn+uorXQQtYa4bHQy0iAYWtcpgNVZB93aF5iAG9GWANctkd7lXRKVz6s+6 jwa6/IXdffSawQo2rGLQ+khml07eyebgP6Oj/Av22uchCzOcjiqc5YOvep6tynZoOOOlK QK/FN5UuivjDZ3YJZM+xXmv76eS/YSEeQ5A1KgcCcGgXu9XMZ9yqd+Bou19Z54HQx63Z0 nsVaK9XVZ3OpqIFZOMkLZxnUSNhiGfkzWSPSlFAYUAUjoI1YTHLitIRo6VqroQj8VgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796002404; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:In-Reply-To:Mime-Version: References:X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=I+mEqZu449hDqTNDDf3IrqehIXIL8MuI/fb1i1lwCo0=; b=Tx4xpDqYO94LMkoafC8uZvRSx2PpE1kgqroYX7eWGb0SXqsMqvA8xS1XxYdmAP6lF45T gFP03e1ZPOd0StfKXZZMuM4yxr7SNy0JsS/kZ/7b+vnQX+PZYG7+/P+4MSuvqQZwb1Pla CnWoItX5Qdef/wPc2wU0tFFV3SILqa3dbQkMLxCnd5pAq0uRYLlpRMunX/Y6bGS5CXzId ESYt84JXhGODcIOH3Xuh7pj6v5YIejmKx8qvqZM3G6GFLCxDyUpr5fa5yq0wL5ozrHRsv QdO3k0R66mb2k/36ebCFqrZbAk+RfmpWoI477SBtj6iX94a+I9j3rGNvIx7hzowfY2g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--jmoroni.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=f8VHI+RI; arc=none smtp.remote-ip=209.85.160.197 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8675B606A31C for ; Mon, 30 Nov 2026 01:33:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8675B606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jmoroni.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=f8VHI+RI Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-55c16eb248eso160052501cf.2 for ; Sun, 29 Nov 2026 17:33:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796002403; x=1796607203; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=I+mEqZu449hDqTNDDf3IrqehIXIL8MuI/fb1i1lwCo0=; b=f8VHI+RIWgyk0T8YKJMeeh/5kezNz0oiLepbDvOmpi038A/rQVX9R8MyEzViNv/MJW A1R9lO6UTNtldShRd4jSAkrOQX9YkIy5l4pDdJqEpjbzs+S00XOvWXjedya3uPizt0Nh IowusMJPXVpgYIZTeB5Uu/5f0gpQLsRv6pV20pi/ucJuFIeVCYVQrG4D2Lq6YUHzY3Xk d/uUNCmkHXRVf5prp1SKP0n0BB8htHuUVkabCMm1DRhlvuuQElwAU8hfuPJYmYCScd0y 0nDQVAGwnMls56FGFMreDLXuHPhIQicu5T0MpXT5ORHWK0yNfUpQ0mpThooPFyilAPv9 0h+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796002403; x=1796607203; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=I+mEqZu449hDqTNDDf3IrqehIXIL8MuI/fb1i1lwCo0=; b=T4h+/bZANBGN2DyvQVY5s3lTYgHaq/5SOJR5SFqnUNZrdMiPBG9P0YWzYbPbMO19tC V3cxC2CLdmv2VTdPAMRUC1pe54Z0AXLzoX7/WvrA2QUnYKJiRqWOU6IG/ZuSEB0bt5ul /NQXyx50KfsGzXliokGJo9IEDjd2P3jvtVmpkLrkeusL3o1yptUpxpGpY2LtXJ73DjoQ AWdjG0UuByLJCGQvrZUhXxFAgcA/BQzKbx1buMEkSz2rN5F2mBem3mcPuez5TcTiFgV3 0Uk8SetoKrFRNOY02QvM1va7DpuTLHNnAq+Mfztneqpfl/phKmOTXBgZS+oHWdJ9Hgv/ W5Wg== X-Gm-Message-State: APuU4Z+YLvPDRmDjtrqHM6MWCDXX5taBy0ljqx/+8fo18jfFldcDXjbh DwQcoZY4hQYQKvmUsESMfmr6FXCdoRvzkjSXVB2KnZ/JUXbjKadxAotmaVzkyHgh8gQ+03hz7LF 84HT0WUc0rg== X-Received: from qtbli26-n2.prod.google.com ([2002:a05:622a:845a:20b0:55a:9488:ca86]) (user=jmoroni job=prod-delivery.src-stubby-dispatcher) by 2002:ac8:5742:0:b0:533:32f3:1db9 with SMTP id d75a77b69052e-55d76938de3mr639114131cf.11.1796002403249; Sun, 29 Nov 2026 17:33:23 -0800 (PST) Date: Mon, 30 Nov 2026 01:33:01 +0000 In-Reply-To: <20261130013307.2848330-1-jmoroni@google.com> X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261130013307.2848330-1-jmoroni@google.com> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261130013307.2848330-3-jmoroni@google.com> Subject: [PATCH rdma-next 2/8] RDMA/irdma: Fix SRQ ID leak when the SRQ depth is rejected From: Jacob Moroni To: tatyana.e.nikolova@intel.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, jdz@google.com, Jacob Moroni Content-Type: text/plain; charset="UTF-8" irdma_create_srq() allocates the SRQ ID before it validates the requested depth, and returns directly if the depth is rejected, so the ID is leaked. max_wr comes from user space, so a user can repeat this until no SRQ IDs are left. Fix this by jumping to the existing unwind label to free the ID. Fixes: 563e1feb5f6e ("RDMA/irdma: Add SRQ support") Signed-off-by: Jacob Moroni --- drivers/infiniband/hw/irdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 5c4da4bb0779..9a673669b72a 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -2603,7 +2603,7 @@ static int irdma_create_srq(struct ib_srq *ibsrq, err_code = irdma_get_srqdepth(ukinfo->uk_attrs, attr->max_wr, shift, &depth); if (err_code) - return err_code; + goto free_rsrc; /* Actual SRQ size in WRs for ring and HW */ ukinfo->srq_size = depth >> shift; -- 2.56.1.839.g22a8290db9-goog