On Mon, May 04, 2020 at 10:37:34AM +0200, Michal Kubecek wrote: > On Mon, May 04, 2020 at 10:04:17AM +0200, Oleksij Rempel wrote: > > @Michal, > > > > i noticed that linkmodes_fill_reply() some times get not enough > > tailroom. > > if data->peer_empty == 0 > > linkmodes_reply_size() size: 476 > > linkmodes_fill_reply() skb tailroom: 724 > > > > > > if data->peer_empty == 1 > > linkmodes_reply_size() size: 216 > > linkmodes_fill_reply() skb tailroom: 212 > > > > In the last case i won't be able to attach master_lave state and cfg > > fields. > > > > It looks like this issue was not introduced by my patches. May be you > > have idea, what is missing? > > It's my mistake, I'm just not sure why I never ran into this while > testing. Please try the patch below. thx! it works now: [ 82.754019] linkmodes_reply_size:103 size: 216 [ 82.758523] linkmodes_fill_reply:117 skb tailroom: 724 [ 126.781892] linkmodes_reply_size:103 size: 476 [ 126.786464] linkmodes_fill_reply:117 skb tailroom: 724 > Michal > > diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c > index 0c772318c023..ed5357210193 100644 > --- a/net/ethtool/netlink.c > +++ b/net/ethtool/netlink.c > @@ -342,7 +342,7 @@ static int ethnl_default_doit(struct sk_buff *skb, struct genl_info *info) > ret = ops->reply_size(req_info, reply_data); > if (ret < 0) > goto err_cleanup; > - reply_len = ret; > + reply_len = ret + ethnl_reply_header_size(); > ret = -ENOMEM; > rskb = ethnl_reply_init(reply_len, req_info->dev, ops->reply_cmd, > ops->hdr_attr, info, &reply_payload); > @@ -588,7 +588,7 @@ static void ethnl_default_notify(struct net_device *dev, unsigned int cmd, > ret = ops->reply_size(req_info, reply_data); > if (ret < 0) > goto err_cleanup; > - reply_len = ret; > + reply_len = ret + ethnl_reply_header_size(); > ret = -ENOMEM; > skb = genlmsg_new(reply_len, GFP_KERNEL); > if (!skb) > diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c > index 95eae5c68a52..0eed4e4909ab 100644 > --- a/net/ethtool/strset.c > +++ b/net/ethtool/strset.c > @@ -324,7 +324,6 @@ static int strset_reply_size(const struct ethnl_req_info *req_base, > int len = 0; > int ret; > > - len += ethnl_reply_header_size(); > for (i = 0; i < ETH_SS_COUNT; i++) { > const struct strset_info *set_info = &data->sets[i]; > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |