From: Michal Schmidt Date: Mon, 2 Jun 2014 16:25:02 +0000 (+0200) Subject: netlink: rate-limit leftover bytes warning and print process name X-Git-Tag: v3.4.95~18 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=6fa2946224569a4f3f975f86193c02c754acc9d8;p=unionfs-2.6.39.y.git netlink: rate-limit leftover bytes warning and print process name [ Upstream commit bfc5184b69cf9eeb286137640351c650c27f118a ] Any process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam. The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program. [v2: Use pr_warn_ratelimited instead of printk_ratelimited.] Signed-off-by: Michal Schmidt Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/nlattr.c b/lib/nlattr.c index 01c67507dc4..60abf1b5545 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -13,6 +13,7 @@ #include #include #include +#include #include static const u16 nla_attr_minlen[NLA_TYPE_MAX+1] = { @@ -197,8 +198,8 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, } if (unlikely(rem > 0)) - printk(KERN_WARNING "netlink: %d bytes leftover after parsing " - "attributes.\n", rem); + pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n", + rem, current->comm); err = 0; errout: