lkml.org 
[lkml]   [2021]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH -next,v2 1/2] audit: fix possible null-pointer dereference in audit_filter_rules
    From
    Date
    Thanks for your review, and i have droped the redundant commit message 
    and add a Fixes tag to the patch.

    https://patchwork.kernel.org/project/linux-audit/patch/20211016072351.237745-2-cuigaosheng1@huawei.com/
    <https://patchwork.kernel.org/project/linux-audit/patch/20211016072351.237745-2-cuigaosheng1@huawei.com/>

    Gaosheng.

    在 2021/10/14 5:12, Paul Moore 写道:
    > On Wed, Oct 13, 2021 at 5:10 AM Gaosheng Cui <cuigaosheng1@huawei.com> wrote:
    >> Fix this possible null-pointer dereference in audit_filter_rules.
    > Thanks for fixing this, just a couple of small comments:
    >
    > I think you can drop the description text below here, the code snippet
    > is just a duplicate of the code and the error message is pretty
    > obvious.
    >
    >> If ctx is null, a null-pointer dereference will occur:
    >> case AUDIT_SADDR_FAM:
    >> if (ctx->sockaddr)
    >> ...
    >> break;
    >>
    >> audit_filter_rules() error: we previously assumed 'ctx' could be null
    >>
    >> Reported-by: kernel test robot <lkp@intel.com>
    >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
    >> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
    > I would also add a Fixes tag, for example:
    >
    > Fixes: bf361231c295 ("audit: add saddr_fam filter field")
    >
    >> ---
    >> kernel/auditsc.c | 2 +-
    >> 1 file changed, 1 insertion(+), 1 deletion(-)
    >>
    >> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
    >> index 4ba3b8573ff4..42d4a4320526 100644
    >> --- a/kernel/auditsc.c
    >> +++ b/kernel/auditsc.c
    >> @@ -647,7 +647,7 @@ static int audit_filter_rules(struct task_struct *tsk,
    >> result = audit_comparator(audit_loginuid_set(tsk), f->op, f->val);
    >> break;
    >> case AUDIT_SADDR_FAM:
    >> - if (ctx->sockaddr)
    >> + if (ctx && ctx->sockaddr)
    >> result = audit_comparator(ctx->sockaddr->ss_family,
    >> f->op, f->val);
    >> break;
    >> --
    >> 2.30.0

    \
     
     \ /
      Last update: 2021-10-16 09:48    [W:4.166 / U:0.524 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site