1 From foo@baz Wed Jun 18 21:53:03 PDT 2014
2 From: Michal Schmidt <mschmidt@redhat.com>
3 Date: Mon, 2 Jun 2014 18:25:02 +0200
4 Subject: netlink: rate-limit leftover bytes warning and print process name
9 From: Michal Schmidt <mschmidt@redhat.com>
11 [ Upstream commit bfc5184b69cf9eeb286137640351c650c27f118a ]
13 Any process is able to send netlink messages with leftover bytes.
14 Make the warning rate-limited to prevent too much log spam.
16 The warning is supposed to help find userspace bugs, so print the
17 triggering command name to implicate the buggy program.
19 [v2: Use pr_warn_ratelimited instead of printk_ratelimited.]
21 Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
22 Signed-off-by: David S. Miller <davem@davemloft.net>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 lib/nlattr.c | 5 +++--
26 1 file changed, 3 insertions(+), 2 deletions(-)
31 #include <linux/skbuff.h>
32 #include <linux/string.h>
33 #include <linux/types.h>
34 +#include <linux/ratelimit.h>
35 #include <net/netlink.h>
37 static const u16 nla_attr_minlen[NLA_TYPE_MAX+1] = {
38 @@ -197,8 +198,8 @@ int nla_parse(struct nlattr **tb, int ma
41 if (unlikely(rem > 0))
42 - printk(KERN_WARNING "netlink: %d bytes leftover after parsing "
43 - "attributes.\n", rem);
44 + pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
45 + rem, current->comm);