mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cuigaosheng <cuigaosheng1@huawei.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.com>, <linux-audit@redhat.com>,
	<linux-kernel@vger.kernel.org>, <xiujianfeng@huawei.com>,
	<wangweiyang2@huawei.com>
Subject: Re: [PATCH -next,v2 1/2] audit: fix possible null-pointer dereference in audit_filter_rules
Date: Sat, 16 Oct 2021 15:47:26 +0800	[thread overview]
Message-ID: <f751d3c6-617c-4ae4-83d1-3b460e312f02@huawei.com> (raw)
In-Reply-To: <CAHC9VhQR4OZWRrQODEjBxhjpH3yPRqPFE4X6RkVFEmv1e9Z8iw@mail.gmail.com>

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

  reply	other threads:[~2021-10-16  7:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  9:12 [PATCH -next,v2 0/2] Audit: fix warning and check priority early Gaosheng Cui
2021-10-13  9:12 ` [PATCH -next,v2 1/2] audit: fix possible null-pointer dereference in audit_filter_rules Gaosheng Cui
2021-10-13 21:12   ` Paul Moore
2021-10-16  7:47     ` cuigaosheng [this message]
2021-10-13  9:12 ` [PATCH -next,v2 2/2] audit: return early if the rule has a lower priority Gaosheng Cui
2021-10-13 21:15   ` Paul Moore
2021-10-16  8:02     ` cuigaosheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f751d3c6-617c-4ae4-83d1-3b460e312f02@huawei.com \
    --to=cuigaosheng1@huawei.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=wangweiyang2@huawei.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®