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=1796287257; b=zlAyQ4otF7HA5IZkzYE5RcsOStvnDUWO+p96iW07MzeEtDhUMEWX/kvt8WqmFBc3By4q ysmbTarsgu2yClaEuzHH6uddcQq8FWKnhi9SgjIGmqlj+unyOEedxyct0hIIM3a2HAWjR QVr4J7MfHOL9Lu+TouQrx2aVs9b8kHYmb6LMIM7LebGpdNxjegrw/AG8JxyuTIRY8rYKp 85nqE3Joxv8Br1x+JTwqFdX+XUOAmieNT5AH36QwuutWhUlkv7XtlyGyB2FdaP2p88x0G I3vTCm7IuIXIy3palY9MhASdBpHVsj4tdATnBQa2GUiLgss2LOYjkSNV1IqYTRFNGzw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287257; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=sIZ6zxSSyVr/A73KApqe8iNEee7s+R7OHjDuvtZ08jk=; b=1O3nSnfo5ZOTjpy5DOUJ8IL3RLE7fnJjZ8rNlo8Q+0SHuULkg+O6RrN2pvFG94b/fquu 41j3lM7xry9VQz9ORAghgF7H2sXgIlg5pAg6V45JckORj9mMHHHgIboh/8Df5TSjm2pZ4 gqneW99VaUPqVLGaYY3/eVvl2/whQuljA3Nk8hSBsLr4bpk8DEglEECSvIXoauH+gGfcG jXhlLFJ6mUSmkAY8R4z+AoHMctRS7wm8VdCvjBDUS3RQShhSfrt0DRAOF+IiODvjDngsp OBSllmqmulcaI5XjswI2D1iVrpqptSXafAkDopX6EtJRXLGH9cmpUEKrrcxjuOczcFw== 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=c3UYhi+0; 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 86CAC606A330 for ; Thu, 3 Dec 2026 08:40:57 +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=c3UYhi+0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03CB21F000C1; Thu, 3 Dec 2026 08:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796287257; bh=sIZ6zxSSyVr/A73KApqe8iNEee7s+R7OHjDuvtZ08jk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=c3UYhi+0U3FLo3mlxIYFWfMk+t0zAeJ4XUsensFX6egUqocB6aqopttcymWacVnT5 S+S3OxkFL6mTa2wz4ndX3YtJEG3I+9bOdo3m4UZaWpreDYvdHCgpJL2pQA9YJHb8ly 2BcCLJVnNlf7OPaLrChITtWqQYib0CejY4RxZFztZnuwPgt5qzzFkXOy906okf62/H qwH0vBQGXCnVWlwT+48MdO8ITiopnb5HaP1gvbem+R+TZT29F+9NSkhmhLKW4LnzO8 WOg9UOhf2tUQivgxVL03VSfy1Zxk6vyQJEgYN7N+511H3be7HHZtgZQSOMULlCU4f0 YTuhnpvIy96uQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v18 6/6] net: dsa: motorcomm: Add support for Motorcomm YT922x Reply-To: sashiko-reviews@lists.linux.dev To: "Kyle Switch" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261202084022.3716891-7-kyle.switch@motor-comm.com> References: <20261202084022.3716891-1-kyle.switch@motor-comm.com> <20261202084022.3716891-7-kyle.switch@motor-comm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 08:40:56 +0000 X-Mailing-List: devicetree@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: - [High] net: dsa: motorcomm: missing teardown op in yt922x_dsa_switch_ops - [Medium] net: dsa: motorcomm: missing mbus_int cleanup in yt922x_dsa_setup() -- commit f80302457342f670aeeea79ebb7ed0ba554f1c97 Author: Kyle Switch net: dsa: motorcomm: Add support for Motorcomm YT922x This commit adds basic DSA switch, phylink MAC, and SerDes PCS support for the Motorcomm YT9224 Ethernet switch. > diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm= /chip.c > index 197dadb1046a4..2a684beac408e 100644 > --- a/drivers/net/dsa/motorcomm/chip.c > +++ b/drivers/net/dsa/motorcomm/chip.c [ ... ] > @@ -2699,6 +2718,480 @@ static const struct dsa_switch_ops yt921x_dsa_swi= tch_ops =3D { [ ... ] > +static int yt922x_dsa_setup(struct dsa_switch *ds) > +{ > + struct yt921x_priv *priv =3D dsa_to_yt921x_priv(ds); > + struct device *dev =3D yt921x_priv_to_device(priv); > + struct device_node *np =3D dev->of_node; > + struct device_node *child; > + int res; > + > + mutex_lock(&priv->reg_lock); > + res =3D yt921x_chip_reset(priv); > + mutex_unlock(&priv->reg_lock); > + if (res) > + return res; > + > + /* Register the internal mdio bus. */ > + child =3D of_get_child_by_name(np, "mdio"); > + if (child) { > + res =3D yt921x_mbus_int_init(priv, child); > + of_node_put(child); > + if (res) > + return res; > + } > + > + mutex_lock(&priv->reg_lock); > + res =3D yt922x_chip_setup(priv); > + mutex_unlock(&priv->reg_lock); > + if (res) > + return res; [Severity: Medium] Does this leak priv->mbus_int if yt922x_chip_setup() fails? yt921x_mbus_int_init() allocates and registers priv->mbus_int with non-devm mdiobus_alloc() and of_mdiobus_register(). Because dsa_switch_setup() does not call ds->ops->teardown when ds->ops->setup fails, returning directly here leaves the MDIO bus registered with mbus->priv pointing to priv after yt921x_mdio_probe() fails and devres frees priv. Unlike yt921x_dsa_setup(), this error path does not call yt921x_mbus_int_cleanup(priv). > + > + /* switch sds pcs setup */ > + yt922x_pcs_setup(ds); > + > + return 0; > +} > + > +static const struct dsa_switch_ops yt922x_dsa_switch_ops =3D { > + /* port */ > + .get_tag_protocol =3D yt922x_dsa_get_tag_protocol, > + .phylink_get_caps =3D yt922x_dsa_phylink_get_caps, > + .port_setup =3D yt922x_dsa_port_setup, > + /* chip */ > + .setup =3D yt922x_dsa_setup, > +}; [Severity: High] Should yt922x_dsa_switch_ops set .teardown to clean up priv->mbus_int? Without .teardown, dsa_switch_teardown() never unregisters or frees priv->mbus_int when the switch is removed in yt921x_mdio_remove() or when dsa_register_switch() fails after setup. On driver unbind, yt921x_mdio_remove() destroys priv->reg_lock and devres frees priv while priv->mbus_int remains live in the MDIO subsystem, causing a use-after-free in yt921x_mbus_int_read() and yt921x_mbus_int_write(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202084022.3716= 891-1-kyle.switch@motor-comm.com?part=3D6