浏览代码

[PATCH] sanity check audit_buffer

Add sanity checks for NULL audit_buffer consistent with other
audit_log* routines.

Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Amy Griffis 18 年之前
父节点
当前提交
8ef2d3040e
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      kernel/audit.c

+ 6 - 0
kernel/audit.c

@@ -1028,6 +1028,9 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf,
 	struct sk_buff *skb;
 	struct sk_buff *skb;
 	static const unsigned char *hex = "0123456789ABCDEF";
 	static const unsigned char *hex = "0123456789ABCDEF";
 
 
+	if (!ab)
+		return;
+
 	BUG_ON(!ab->skb);
 	BUG_ON(!ab->skb);
 	skb = ab->skb;
 	skb = ab->skb;
 	avail = skb_tailroom(skb);
 	avail = skb_tailroom(skb);
@@ -1060,6 +1063,9 @@ static void audit_log_n_string(struct audit_buffer *ab, size_t slen,
 	unsigned char *ptr;
 	unsigned char *ptr;
 	struct sk_buff *skb;
 	struct sk_buff *skb;
 
 
+	if (!ab)
+		return;
+
 	BUG_ON(!ab->skb);
 	BUG_ON(!ab->skb);
 	skb = ab->skb;
 	skb = ab->skb;
 	avail = skb_tailroom(skb);
 	avail = skb_tailroom(skb);