Skip to content

Commit c3fc997

Browse files
committed
ethtool: tsinfo: don't pass ERR_PTR to genlmsg_cancel on prepare failure
The goto err label leads to: genlmsg_cancel(skb, ehdr); return ret; If ethnl_tsinfo_prepare_dump() failed, it has not started a genlmsg. There's nothing to cancel, and passing an error pointer to genlmsg_cancel() would cause a crash. Fixes: b9e3f7d ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology") Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Kory Maincent <kory.maincent@bootlin.com> Link: https://patch.msgid.link/20260526153533.2779187-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1de4056 commit c3fc997

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

net/ethtool/tsinfo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,8 @@ static int ethnl_tsinfo_dump_one_netdev(struct sk_buff *skb,
407407
continue;
408408

409409
ehdr = ethnl_tsinfo_prepare_dump(skb, dev, reply_data, cb);
410-
if (IS_ERR(ehdr)) {
411-
ret = PTR_ERR(ehdr);
412-
goto err;
413-
}
410+
if (IS_ERR(ehdr))
411+
return PTR_ERR(ehdr);
414412

415413
reply_data->ts_info.phc_qualifier = ctx->pos_phcqualifier;
416414
ret = ops->get_ts_info(dev, &reply_data->ts_info);

0 commit comments

Comments
 (0)