Skip to content

Commit bfc5184

Browse files
michichdavem330
authored andcommitted
netlink: rate-limit leftover bytes warning and print process name
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c65c7a3 commit bfc5184

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/nlattr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
201201
}
202202

203203
if (unlikely(rem > 0))
204-
printk(KERN_WARNING "netlink: %d bytes leftover after parsing "
205-
"attributes.\n", rem);
204+
pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
205+
rem, current->comm);
206206

207207
err = 0;
208208
errout:

0 commit comments

Comments
 (0)