Re: [PATCH net] genetlink: fix genlmsg_nlhdr()

2017-11-15 Thread David Miller
From: Michal Kubecek 
Date: Wed, 15 Nov 2017 13:09:32 +0100 (CET)

> According to the description, first argument of genlmsg_nlhdr() points to
> what genlmsg_put() returns, i.e. beginning of user header. Therefore we
> should only subtract size of genetlink header and netlink message header,
> not user header.
> 
> This also means we don't need to pass the pointer to genetlink family and
> the same is true for genl_dump_check_consistent() which is the only caller
> of genlmsg_nlhdr(). (Note that at the moment, these functions are only
> used for families which do not have user header so that they are not
> affected.)
> 
> Fixes: 670dc2833d14 ("netlink: advertise incomplete dumps")
> Signed-off-by: Michal Kubecek 

Applied.


Re: [PATCH net] genetlink: fix genlmsg_nlhdr()

2017-11-15 Thread Michal Kubecek
On Wed, Nov 15, 2017 at 01:20:10PM +0100, Johannes Berg wrote:
> On Wed, 2017-11-15 at 13:09 +0100, Michal Kubecek wrote:
> > According to the description, first argument of genlmsg_nlhdr() points to
> > what genlmsg_put() returns, i.e. beginning of user header. Therefore we
> > should only subtract size of genetlink header and netlink message header,
> > not user header.
> > 
> > This also means we don't need to pass the pointer to genetlink family and
> > the same is true for genl_dump_check_consistent() which is the only caller
> > of genlmsg_nlhdr(). (Note that at the moment, these functions are only
> > used for families which do not have user header so that they are not
> > affected.)
> > 
> > Fixes: 670dc2833d14 ("netlink: advertise incomplete dumps")
> > Signed-off-by: Michal Kubecek 
> 
> Looks sensible, though I don't think it's really needed in net since it
> really has no effect - as you note, family->hdrsize is 0 for all the
> families calling this right now.
> 
> Reviewed-by: Johannes Berg 

Well, I'm currently working on one with hdrsize > 0 which is how I found
this. :-) But it will still need some time before it can get even into
net-next.

Michal Kubecek



Re: [PATCH net] genetlink: fix genlmsg_nlhdr()

2017-11-15 Thread Johannes Berg
On Wed, 2017-11-15 at 13:09 +0100, Michal Kubecek wrote:
> According to the description, first argument of genlmsg_nlhdr() points to
> what genlmsg_put() returns, i.e. beginning of user header. Therefore we
> should only subtract size of genetlink header and netlink message header,
> not user header.
> 
> This also means we don't need to pass the pointer to genetlink family and
> the same is true for genl_dump_check_consistent() which is the only caller
> of genlmsg_nlhdr(). (Note that at the moment, these functions are only
> used for families which do not have user header so that they are not
> affected.)
> 
> Fixes: 670dc2833d14 ("netlink: advertise incomplete dumps")
> Signed-off-by: Michal Kubecek 

Looks sensible, though I don't think it's really needed in net since it
really has no effect - as you note, family->hdrsize is 0 for all the
families calling this right now.

Reviewed-by: Johannes Berg 

johannes