diff mbox series

[net-next,v2] ethtool: cabletest: fix wrong conditional check

Message ID 20240828021005.9886-1-djahchankoike@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] ethtool: cabletest: fix wrong conditional check | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: andrew@lunn.ch
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Diogo Jahchan Koike Aug. 28, 2024, 2:09 a.m. UTC
In ethnl_act_cable_test_tdr, phydev is tested for the condition of being
null or an error by checking IS_ERR_OR_NULL, however the result is being
negated and lets a null phydev go through. Simply removing the logical
NOT on the conditional suffices.

Reported-by: syzbot+5cf270e2069645b6bd2c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5cf270e2069645b6bd2c
Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
Signed-off-by: Diogo Jahchan Koike <djahchankoike@gmail.com>
---
The previous patch was sent without the appropriate tags, apologize for
that.
---
 net/ethtool/cabletest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Aug. 28, 2024, 2:33 a.m. UTC | #1
On Tue, 27 Aug 2024 23:09:19 -0300 Diogo Jahchan Koike wrote:
> In ethnl_act_cable_test_tdr, phydev is tested for the condition of being
> null or an error by checking IS_ERR_OR_NULL, however the result is being
> negated and lets a null phydev go through. Simply removing the logical
> NOT on the conditional suffices.
> 
> Reported-by: syzbot+5cf270e2069645b6bd2c@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5cf270e2069645b6bd2c
> Fixes: 3688ff3077d3 ("net: ethtool: cable-test: Target the command to the requested PHY")
> Signed-off-by: Diogo Jahchan Koike <djahchankoike@gmail.com>
> ---
> The previous patch was sent without the appropriate tags, apologize for
> that.

You were already told by Eric not to repost within 24h.

https://lore.kernel.org/all/CANn89iJ0qNYP8zMz6jDtP2=n23emnue4m2tyJkE64QL_xiwc9Q@mail.gmail.com/

There's already a fix from Maxime pending for this:
https://lore.kernel.org/all/20240827092314.2500284-1-maxime.chevallier@bootlin.com/

I didn't need to see the tags to tell you this.

> diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
> index d365ad5f5434..f25da884b3dd 100644
> --- a/net/ethtool/cabletest.c
> +++ b/net/ethtool/cabletest.c
> @@ -346,7 +346,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
>  	phydev = ethnl_req_get_phydev(&req_info,
>  				      tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
>  				      info->extack);
> -	if (!IS_ERR_OR_NULL(phydev)) {
> +	if (IS_ERR_OR_NULL(phydev)) {
>  		ret = -EOPNOTSUPP;
>  		goto out_dev_put;
>  	}
diff mbox series

Patch

diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c
index d365ad5f5434..f25da884b3dd 100644
--- a/net/ethtool/cabletest.c
+++ b/net/ethtool/cabletest.c
@@ -346,7 +346,7 @@  int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
 	phydev = ethnl_req_get_phydev(&req_info,
 				      tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
 				      info->extack);
-	if (!IS_ERR_OR_NULL(phydev)) {
+	if (IS_ERR_OR_NULL(phydev)) {
 		ret = -EOPNOTSUPP;
 		goto out_dev_put;
 	}