From: Jakub Kicinski <kuba@kernel•org>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org, edumazet@google•com, pabeni@redhat•com,
andrew+netdev@lunn•ch, horms@kernel•org, o.rempel@pengutronix•de,
kory.maincent@bootlin•com, maxime.chevallier@bootlin•com,
haiyangz@microsoft•com, Jakub Kicinski <kuba@kernel•org>,
andrew@lunn•ch, vadim.fedorenko@linux•dev
Subject: [PATCH net 02/10] ethtool: tsconfig: fix reply error handling
Date: Tue, 26 May 2026 08:35:25 -0700 [thread overview]
Message-ID: <20260526153533.2779187-3-kuba@kernel.org> (raw)
In-Reply-To: <20260526153533.2779187-1-kuba@kernel.org>
A couple of trivial bugs in error handling in tsconfig_send_reply().
If we failed to allocate rskb we need to set the error.
If we did allocate it but failed to send it - we need to remember
to free it.
Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config")
Signed-off-by: Jakub Kicinski <kuba@kernel•org>
---
CC: andrew@lunn•ch
CC: vadim.fedorenko@linux•dev
CC: kory.maincent@bootlin•com
---
net/ethtool/tsconfig.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c
index e4f518e49d4c..e9db4ee2299d 100644
--- a/net/ethtool/tsconfig.c
+++ b/net/ethtool/tsconfig.c
@@ -224,16 +224,21 @@ static int tsconfig_send_reply(struct net_device *dev, struct genl_info *info)
reply_len = ret + ethnl_reply_header_size();
rskb = ethnl_reply_init(reply_len, dev, ETHTOOL_MSG_TSCONFIG_SET_REPLY,
ETHTOOL_A_TSCONFIG_HEADER, info, &reply_payload);
- if (!rskb)
+ if (!rskb) {
+ ret = -ENOMEM;
goto err_cleanup;
+ }
ret = tsconfig_fill_reply(rskb, &req_info->base, &reply_data->base);
if (ret < 0)
- goto err_cleanup;
+ goto err_free_msg;
genlmsg_end(rskb, reply_payload);
ret = genlmsg_reply(rskb, info);
+ rskb = NULL;
+err_free_msg:
+ nlmsg_free(rskb);
err_cleanup:
kfree(reply_data);
kfree(req_info);
--
2.54.0
next prev parent reply other threads:[~2026-05-26 15:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 15:35 [PATCH net 00/10] ethtool: more bug fixes Jakub Kicinski
2026-05-26 15:35 ` [PATCH net 01/10] ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES Jakub Kicinski
2026-05-26 17:41 ` Maxime Chevallier
2026-05-26 15:35 ` Jakub Kicinski [this message]
2026-05-26 16:04 ` [PATCH net 02/10] ethtool: tsconfig: fix reply error handling Vadim Fedorenko
2026-05-27 14:32 ` Kory Maincent
2026-05-26 15:35 ` [PATCH net 03/10] ethtool: linkstate: fix unbalanced ethnl_ops_complete() on PHY lookup error Jakub Kicinski
2026-05-26 16:41 ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 04/10] ethtool: pse-pd: fix missing ethnl_ops_complete() Jakub Kicinski
2026-05-26 16:51 ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 05/10] ethtool: tsconfig: " Jakub Kicinski
2026-05-26 16:06 ` Vadim Fedorenko
2026-05-27 14:34 ` Kory Maincent
2026-05-26 15:35 ` [PATCH net 06/10] ethtool: tsinfo: fix uninitialized stats on the by-PHC path Jakub Kicinski
2026-05-26 17:23 ` Maxime Chevallier
2026-05-26 22:51 ` Jakub Kicinski
2026-05-26 15:35 ` [PATCH net 07/10] ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure Jakub Kicinski
2026-05-26 17:46 ` Maxime Chevallier
2026-05-27 14:35 ` Kory Maincent
2026-05-26 15:35 ` [PATCH net 08/10] ethtool: strset: fix header attribute index in ethnl_req_get_phydev() Jakub Kicinski
2026-05-26 17:15 ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 09/10] ethtool: eeprom: add missing ethnl_ops_begin() / _complete() during fallback Jakub Kicinski
2026-05-26 17:13 ` Maxime Chevallier
2026-05-26 15:35 ` [PATCH net 10/10] ethtool: eeprom: add more safeties to EEPROM Netlink fallback Jakub Kicinski
2026-05-26 17:30 ` Maxime Chevallier
2026-05-28 1:00 ` [PATCH net 00/10] ethtool: more bug fixes patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526153533.2779187-3-kuba@kernel.org \
--to=kuba@kernel$(echo .)org \
--cc=andrew+netdev@lunn$(echo .)ch \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=haiyangz@microsoft$(echo .)com \
--cc=horms@kernel$(echo .)org \
--cc=kory.maincent@bootlin$(echo .)com \
--cc=maxime.chevallier@bootlin$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=o.rempel@pengutronix$(echo .)de \
--cc=pabeni@redhat$(echo .)com \
--cc=vadim.fedorenko@linux$(echo .)dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox