Skip to content

Commit

Permalink
net: nla_align_64bit() needs to test the right pointer.
Browse files Browse the repository at this point in the history
Netlink messages are appended, one object at a time, to the end of
the SKB.  Therefore we need to test skb_tail_pointer() not skb->data
for alignment.

Fixes: 35c5845 ("net: Add helpers for 64-bit aligning netlink attributes.")
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Apr 20, 2016
1 parent cca1d81 commit e6f268e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
* nlattr header for next attribute, will make nla_data()
* 8-byte aligned.
*/
if (IS_ALIGNED((unsigned long)skb->data, 8) &&
if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8) &&
!nla_reserve(skb, padattr, 0))
return -EMSGSIZE;
#endif
Expand Down

0 comments on commit e6f268e

Please sign in to comment.