提交 fcfdde9c 编写于 作者: C Cui GaoSheng 提交者: Zheng Zengkai

audit: bugfix for infinite loop when flush the hold queue

hulk inclusion
category: bugfix
bugzilla: 186133 https://gitee.com/openeuler/kernel/issues/I4RGWS?from=project-issue
CVE: NA

-----------------------------------------------------------------

When we add "audit=1" to the cmdline, if we keep the audit_hold_queue
non-empty, flush the hold queue will fall into an infinite loop. So we
need to fix it by stoping flush the hold queue when netlink abnormal.

Fixes: bd8698d8 ("audit: improve robustness of the audit queue handling")
Signed-off-by: NCui GaoSheng <cuigaosheng1@huawei.com>
Reviewed-by: Nweiyang wang <wangweiyang2@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 556e8ce5
...@@ -732,6 +732,8 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, ...@@ -732,6 +732,8 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
if (!sk) { if (!sk) {
if (err_hook) if (err_hook)
(*err_hook)(skb); (*err_hook)(skb);
if (queue == &audit_hold_queue)
goto out;
continue; continue;
} }
...@@ -748,6 +750,8 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, ...@@ -748,6 +750,8 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
(*err_hook)(skb); (*err_hook)(skb);
if (rc == -EAGAIN) if (rc == -EAGAIN)
rc = 0; rc = 0;
if (queue == &audit_hold_queue)
goto out;
/* continue to drain the queue */ /* continue to drain the queue */
continue; continue;
} else } else
...@@ -759,6 +763,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, ...@@ -759,6 +763,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
} }
} }
out:
return (rc >= 0 ? 0 : rc); return (rc >= 0 ? 0 : rc);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册