From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796487010; b=1G0q7HxwNQuo7upAHHBPupreUsaaMv+YfUGGc/DOqpke+pQ1PQZggwwdUU2+lOUNwwWw 3TCxClXdUDSg82OL7bfcHW1QeKHXumwOXWEzhOOGlZY2fshs2mO/JqJBi7CyD9vRXNxH0 SazBdwfA8Ha6emZhu2oDeOWHwK1gNgQQfKJwAhcwkNIHWKwg+eeugqyLEiqX6Jb5zTw4h CKOzIdqicOBAEp8xI5dW/M/I92PfrXJnQK9qtofdqCdvm6gzkwe1ghfCd1/ZuyFhPzG00 /tR70bqfUTIUa8e8lFlXtVdX0U+MVE4p0OKbUY1se2YC7j0bB2ISjLm01Gcy7e0neJQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796487010; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=RuIJDvfJ1vte0RWxL09W9Jbf2EXyiGpWgY2yBGciK6s=; b=m2EXzadryNt2XzmvOOJ7J67XD62qOb2S6RDR2/ccnYLzGCH1d63rqr3YdRL2/9S2v+bn aqqpCXGAC13U2luwzLk+DvVXrVqQo517fCEcjbMHGyDjPbrc+xxABy3TL04Q8vFXXAQCt qFAvoQiDL15XaOaNC8c5Euiy5QT7W9DJjTuhAJZZCSAktLHoIaksVXbT6pw/p85J1+Een ZR1AEKUCkDv5m+wTyGneHyxUnMAjDhg+oACdEGt+o6xteQGo9jf6IYB7h/8Edwrnn/kTm Lv9CuvmuNUcYqNxcKFjRrcxFWe0osgMATszdDbUQrzQHqFkPRSmMcSJWX1IrtD8U8tQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=k3XYODAP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAF50606A33A for ; Sat, 5 Dec 2026 16:10:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=k3XYODAP Received: by smtp.kernel.org (Postfix) with ESMTPSA id 800E51F00A12; Sat, 5 Dec 2026 16:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796487009; bh=RuIJDvfJ1vte0RWxL09W9Jbf2EXyiGpWgY2yBGciK6s=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=k3XYODAPAMoCuVtQ1ObISAG+djx/9UNpseThBgjh6IaciTmxCmFfNHf8WEykco7c1 XHcOyDswATnSkMTFInhX0njJU1sMZVWTLQUmjsHoOKbOe61GJCM25AVEMetXvsPsK+ mEpbed+jOr87fzwAgWX7pgP//NKX4Ve6pDLX4Ap5Ya2QKPUeHCaEeoQZ7KecubgUbC cfoJWLryiB4RwJQBMOV6mlAbKxJ6biffaXbbjzS3Pj37iy8LodjVKuc7w7gl/SdIMd jpgzI80vXa5tOk0vurJVgv5b8IQTIOFbr8uhz3xsKb9C7toKiRRNv+U1fZPI2nRgcf sE9hoBtrWvhfA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RDMA v2 06/13] RDMA/bng_re: Add PD verbs Reply-To: sashiko-reviews@lists.linux.dev To: "Siva Reddy Kallam" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261204155249.1002019-7-siva.kallam@broadcom.com> References: <20261204155249.1002019-1-siva.kallam@broadcom.com> <20261204155249.1002019-7-siva.kallam@broadcom.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 16:10:09 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] RDMA/bng_re: unratelimited ibdev_err() log flood in bng_re_alloc_pd() - [Medium] RDMA/bng_re: missing ib_no_udata_io() validation in bng_re_dealloc_pd() -- commit 82d94e76706f3157f51a5468de873f06e5c49ee4 Author: Suresh Rupanagudi RDMA/bng_re: Add PD verbs This commit adds the alloc_pd and dealloc_pd verbs for bng_re using a software IDA backed by the firmware-reported max_pd limit. > diff --git a/drivers/infiniband/hw/bng_re/bng_verbs.c b/drivers/infiniban= d/hw/bng_re/bng_verbs.c > index 59fa84040476b..95317907d6125 100644 > --- a/drivers/infiniband/hw/bng_re/bng_verbs.c > +++ b/drivers/infiniband/hw/bng_re/bng_verbs.c > @@ -459,3 +459,46 @@ int bng_re_del_gid(const struct ib_gid_attr *attr, v= oid **context) > =20 > return rc; > } > + > +int bng_re_alloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata) > +{ > + struct bng_re_pd *pd =3D container_of(ib_pd, struct bng_re_pd, ib_pd); > + struct ib_device *ibdev =3D ib_pd->device; > + struct bng_re_dev *rdev =3D container_of(ibdev, struct bng_re_dev, ibde= v); > + int rc; > + > + pd->rdev =3D rdev; > + > + rc =3D ib_is_udata_in_empty(udata); > + if (rc) > + return rc; > + > + rc =3D bng_sp_alloc_pd(&rdev->bng_res, &pd->sp_pd); > + if (rc) { > + ibdev_err(&rdev->ibdev, "Failed to allocate PD: %d\n", rc); > + return rc; > + } > + > + if (udata) { > + struct bng_re_pd_resp resp =3D {}; > + > + resp.pdid =3D pd->sp_pd.id; > + rc =3D ib_respond_udata(udata, resp); > + if (rc) { > + ibdev_err(&rdev->ibdev, "Failed to copy PD udata\n"); > + bng_sp_dealloc_pd(&rdev->bng_res, &pd->sp_pd); > + return rc; > + } > + } > + > + return 0; > +} [Severity: Medium] Can an unprivileged user flood the kernel log through these two ibdev_err() calls? Passing an unmapped response buffer to IB_USER_VERBS_CMD_ALLOC_PD hits the ib_respond_udata() error path and frees the PD right away, allowing a tight loop that consumes no PD slots. Exhausting max_pd hits the first ibdev_err() on every further call as well. _ib_respond_udata() uses ibdev_dbg() on EFAULT for this reason; switching these to ibdev_dbg() or ibdev_err_ratelimited() would prevent log flooding. > + > +int bng_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata) > +{ > + struct bng_re_pd *pd =3D container_of(ib_pd, struct bng_re_pd, ib_pd); > + struct bng_re_dev *rdev =3D pd->rdev; > + > + bng_sp_dealloc_pd(&rdev->bng_res, &pd->sp_pd); > + return 0; > +} [Severity: Medium] Should bng_re_dealloc_pd() call ib_no_udata_io(udata) before freeing the PD? When userspace invokes IB_USER_VERBS_CMD_DEALLOC_PD through UVERBS_METHOD_INVOKE_WRITE, ib_uverbs_run_method() populates driver_udata and forwards it via uverbs_free_pd() -> ib_dealloc_pd_user(). Ignoring udata silently accepts non-zero driver input instead of returning -EOPNOTSUPP, and leaves any output buffer untouched even though ib_uverbs_run_method() marks UVERBS_ATTR_UHW_OUT valid on a zero return. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204155249.1002= 019-1-siva.kallam@broadcom.com?part=3D6