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=1796163040; b=0HG2/qwE3ZaYIwZ3SZNWROYcDkNMjmBA2Lmn1u+mGf5pTMxGUGU/FlSZFc/vRIE8/mc3 04Ve0bWEVMS8BT7qvEjXq+71u6HqptdzBRWznkPV1y3CvDSGb/mgN9k1HTitvieP0VQsC x0/7xTJxOewxMz2H6V8wdnynCfsfCjQ3iZLHq0QgLGOkq94oR0qno6ARYmZEW9pn7EPMo zeoKn809TLetcPAWGHsndi1hu4qVqcv5hN7ZcTPcvJphp8u0hZcWj41bmXGWDDIQz1bZw qYTWYwrlxa46R8FccJbo0D/hkCEqDrNLir750whICaJjdgTE3njnLoiwhG3bvI3tSow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796163040; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=1q6+TkrtJ10tZEDCjQjYZZT/dAV5QSlTtKhUNX9NoAA=; b=xMkGq2mFayLJCCk3rXjdE44bNVvzD93tpblch5fMabNqkiXmZd7B+STiCtotNr8IpCaC dRgOkkDm1K0sg6hjufzMuwpqO3g8cSkIlq8P08awhcSfIrJehtiHq1FDX/vLMEiKTvyTc G4ZjBqJGZcK/ultzng7j3g+d0WF0hbadBxX+Ktj8xXDCTjInsCF41yPwMkdjsnqfLCnEe s7+BAfvyBXJrRZN1yKL14nPIUKRC+aaytniYJZb43XmU1c6sAo6PCSj7LjvHCluv6MSoT HBN7o1WcIYx12OKidrojPaPJXoJtraJLVUSuuy3DJqRQzSfzTIev1zAdTeL/bmcjbOQ== 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=Pno0sBeg; 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 21CE2606A31A for ; Tue, 1 Dec 2026 22:10:40 +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=Pno0sBeg Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAEDC1F00897; Tue, 1 Dec 2026 22:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796163040; bh=1q6+TkrtJ10tZEDCjQjYZZT/dAV5QSlTtKhUNX9NoAA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Pno0sBegVIZOJYe3M9fkw3gCBjQRyhoD4+eNag5E7h9XDutkvrw03mDQ1/Z1uURa4 9OP54w5GPAvfSmmcZX7EN6W9U+zGiBZ32e5CqvGFSJdNLGetITO4dk71PrSBHxpEw4 6kr6mmK4T0pyhQiwtOaq5PpTyITP3/lJS2yLdREHe7zMQyP1i1e69Vaa+XuzKZ+mox w98TwxdfTujzEOKxexI8L5Ldvan5x69KhUYf7866337TRnuY+MxUP0f7OEhRQtmNhd W0kKTvjuwWXsEpgIletFv87v53X694OOU4Mpq0tNTG3Kx0+3TJEYtdtKFtWY+G8/Q4 0onh24HTMGJuw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode Reply-To: sashiko-reviews@lists.linux.dev To: "Stefan Metzmacher" Cc: intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org In-Reply-To: <04b80a45d0b1544b0b32e9ee72223f09005fa51c.1796076486.git.metze@samba.org> References: <04b80a45d0b1544b0b32e9ee72223f09005fa51c.1796076486.git.metze@samba.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 22:10:39 +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 1 potential issue to consider: - [Medium] ice: race between ice_devlink_enable_rdma_set() and concurrent plug or reset It also noticed 1 related pre-existing issue this patch does not introduce: - [High] ice: NULL pointer dereference in ice_devlink_enable_iw_validate() [1] -- commit 5131a328af0137c04875bae323e3ebe30dcdfd51 Author: Stefan Metzmacher ice: support the enable_rdma devlink param in runtime cmode This commit adds runtime configuration mode support for the enable_rdma devlink parameter so the RDMA auxiliary device can be plugged or unplugged without reloading the PF netdev. > diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/n= et/ethernet/intel/ice/devlink/devlink.c > index 5a69f0f8a7bc4..8d816631df69f 100644 > --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c > +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c [ ... ] > @@ -1626,6 +1629,62 @@ ice_devlink_msix_min_pf_validate(struct devlink *d= evlink, u32 id, [ ... ] > +static int ice_devlink_enable_rdma_set(struct devlink *devlink, u32 id, > + struct devlink_param_gset_ctx *ctx, > + struct netlink_ext_ack *extack) > +{ > + struct ice_pf *pf =3D devlink_priv(devlink); > + bool disable =3D !ctx->val.vbool; > + int ret; > + > + if (!disable && !ice_is_rdma_ena(pf)) { > + NL_SET_ERR_MSG_MOD(extack, > + "RDMA is disabled in driverinit cmode, enable it there and reload= "); > + return -EOPNOTSUPP; > + } > + > + if (test_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags) =3D=3D disable) > + return 0; > + > + if (disable) { > + set_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags); > + ice_unplug_aux_dev(pf); > + return 0; > + } > + > + if (!pf->cdev_info || !pf->cdev_info->rdma_protocol) { > + NL_SET_ERR_MSG_MOD(extack, > + "Neither enable_roce nor enable_iwarp is set"); > + return -EOPNOTSUPP; > + } > + > + clear_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags); > + ret =3D ice_plug_aux_dev(pf); > + if (ret) > + set_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags); > + > + return ret; > +} [Severity: Medium] Can ice_devlink_enable_rdma_set() race with ice_plug_aux_dev() or a PF reset running on pf->serv_task? ice_devlink_enable_rdma_set() runs under devl_lock(devlink), while ice_service_task() and PF reset/rebuild call ice_plug_aux_dev() and ice_unplug_aux_dev() without holding devl_lock(devlink), and pf->adev_mutex only covers the cdev->adev assignment: CPU0 CPU1 (pf->serv_task) ice_plug_aux_dev() test_bit(ICE_FLAG_RDMA_RUNTIME_D= IS, ...) -> 0 ... ice_devlink_enable_rdma_set() set_bit(ICE_FLAG_RDMA_RUNTIME_DIS, ...) ice_unplug_aux_dev() test_and_clear_bit( ICE_FLAG_AUX_DEV_CREATED, ...) -> 0 (returns early) auxiliary_device_add(adev) set_bit(ICE_FLAG_AUX_DEV_CREATED, ...) <-- aux dev stays plugged The auxiliary device remains registered while ICE_FLAG_RDMA_RUNTIME_DIS is set and ice_devlink_enable_rdma_get() reports false. In addition, if ice_devlink_enable_rdma_set() enables RDMA while a PF reset is in progress between ice_prepare_for_reset() and ice_rebuild(), it plugs the auxiliary device mid-reset and ice_rebuild() -> ice_rdma_finalize_setup() then calls ice_plug_aux_dev() a second time. > @@ -1654,8 +1713,11 @@ static const struct devlink_param ice_dvl_rdma_par= ams[] =3D { > ice_devlink_enable_iw_get, > ice_devlink_enable_iw_set, > ice_devlink_enable_iw_validate), > - DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), > - NULL, NULL, ice_devlink_enable_rdma_validate), > + DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT) | > + BIT(DEVLINK_PARAM_CMODE_RUNTIME), > + ice_devlink_enable_rdma_get, > + ice_devlink_enable_rdma_set, > + ice_devlink_enable_rdma_validate), > }; [Severity: High] This problem wasn't introduced by this patch, but can ice_devlink_enable_iw_validate() [1] trigger a NULL pointer dereference on pf->cdev_info when enable_rdma is false in driverinit cmode? When enable_rdma is disabled in driverinit cmode and the PF is reloaded, ice_deinit_rdma() frees and clears pf->cdev_info, ice_set_pf_caps() still sets ICE_FLAG_RDMA_ENA, and ice_init_rdma() returns early because ice_is_rdma_ena() is false. Unlike ice_devlink_enable_rdma_set() and ice_devlink_enable_roce_validate(), ice_devlink_enable_iw_validate() only checks ICE_FLAG_RDMA_ENA before dereferencing pf->cdev_info: drivers/net/ethernet/intel/ice/devlink/devlink.c:ice_devlink_enable_iw_vali= date() { struct ice_pf *pf =3D devlink_priv(devlink); if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) return -EOPNOTSUPP; if (pf->cdev_info->rdma_protocol & IIDC_RDMA_PROTOCOL_ROCEV2) { ... } Setting enable_iwarp in that state dereferences a NULL pf->cdev_info. [1] https://sashiko.dev/#/bug/linux-aab1240e-86ed-43b4-be4c-d5891c480f23 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796076486.gi= t.metze@samba.org?part=3D3