summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMathias Krause <minipli@googlemail.com>2013-09-30 22:04:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 10:50:31 -0800
commit42979968049cc6a8ed569ae8ceb486e0637c7ce7 (patch)
tree8e7f4c4af4dc50d16a46d74ea1a8f9beb1cbab99 /kernel
parente49ee6c66ebfdf4a4fb0cecad2523c7b61fc0282 (diff)
audit: use nlmsg_len() to get message payload length
commit 4d8fe7376a12bf4524783dd95cbc00f1fece6232 upstream. Using the nlmsg_len member of the netlink header to test if the message is valid is wrong as it includes the size of the netlink header itself. Thereby allowing to send short netlink messages that pass those checks. Use nlmsg_len() instead to test for the right message length. The result of nlmsg_len() is guaranteed to be non-negative as the netlink message already passed the checks of nlmsg_ok(). Also switch to min_t() to please checkpatch.pl. Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Eric Paris <eparis@redhat.com> Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/audit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index c6ed3f10114d..a57194b61418 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -695,7 +695,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
&status_set, sizeof(status_set));
break;
case AUDIT_SET:
- if (nlh->nlmsg_len < sizeof(struct audit_status))
+ if (nlmsg_len(nlh) < sizeof(struct audit_status))
return -EINVAL;
status_get = (struct audit_status *)data;
if (status_get->mask & AUDIT_STATUS_ENABLED) {