]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.95/netlink-rate-limit-leftover-bytes-warning-and-print-process-name.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.95 / netlink-rate-limit-leftover-bytes-warning-and-print-process-name.patch
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
5 Status: RO
6 Content-Length: 1053
7 Lines: 34
8
9 From: Michal Schmidt <mschmidt@redhat.com>
10
11 [ Upstream commit bfc5184b69cf9eeb286137640351c650c27f118a ]
12
13 Any process is able to send netlink messages with leftover bytes.
14 Make the warning rate-limited to prevent too much log spam.
15
16 The warning is supposed to help find userspace bugs, so print the
17 triggering command name to implicate the buggy program.
18
19 [v2: Use pr_warn_ratelimited instead of printk_ratelimited.]
20
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>
24 ---
25 lib/nlattr.c | 5 +++--
26 1 file changed, 3 insertions(+), 2 deletions(-)
27
28 --- a/lib/nlattr.c
29 +++ b/lib/nlattr.c
30 @@ -13,6 +13,7 @@
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>
36
37 static const u16 nla_attr_minlen[NLA_TYPE_MAX+1] = {
38 @@ -197,8 +198,8 @@ int nla_parse(struct nlattr **tb, int ma
39 }
40
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);
46
47 err = 0;
48 errout: