linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] EVM: fix return value check in evm_write_xattrs()
@ 2018-07-11 13:28 Wei Yongjun
  2018-07-11 15:15 ` Serge E. Hallyn
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2018-07-11 13:28 UTC (permalink / raw)
  To: Mimi Zohar, James Morris, Serge E. Hallyn, Matthew Garrett
  Cc: Wei Yongjun, linux-integrity, linux-security-module, kernel-janitors

In case of error, the function audit_log_start() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 security/integrity/evm/evm_secfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
index 637eb99..77de71b 100644
--- a/security/integrity/evm/evm_secfs.c
+++ b/security/integrity/evm/evm_secfs.c
@@ -193,8 +193,8 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
 		return -E2BIG;
 
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR);
-	if (IS_ERR(ab))
-		return PTR_ERR(ab);
+	if (!ab)
+		return -ENOMEM;
 
 	xattr = kmalloc(sizeof(struct xattr_list), GFP_KERNEL);
 	if (!xattr) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] EVM: fix return value check in evm_write_xattrs()
  2018-07-11 13:28 [PATCH -next] EVM: fix return value check in evm_write_xattrs() Wei Yongjun
@ 2018-07-11 15:15 ` Serge E. Hallyn
  2018-07-22 23:38   ` Mimi Zohar
  0 siblings, 1 reply; 3+ messages in thread
From: Serge E. Hallyn @ 2018-07-11 15:15 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Mimi Zohar, James Morris, Serge E. Hallyn, Matthew Garrett,
	linux-integrity, linux-security-module, kernel-janitors

Quoting Wei Yongjun (weiyongjun1@huawei.com):
> In case of error, the function audit_log_start() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.
> 
> Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Serge Hallyn <serge@hallyn.com>

> ---
>  security/integrity/evm/evm_secfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c
> index 637eb99..77de71b 100644
> --- a/security/integrity/evm/evm_secfs.c
> +++ b/security/integrity/evm/evm_secfs.c
> @@ -193,8 +193,8 @@ static ssize_t evm_write_xattrs(struct file *file, const char __user *buf,
>  		return -E2BIG;
>  
>  	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR);
> -	if (IS_ERR(ab))
> -		return PTR_ERR(ab);
> +	if (!ab)
> +		return -ENOMEM;
>  
>  	xattr = kmalloc(sizeof(struct xattr_list), GFP_KERNEL);
>  	if (!xattr) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] EVM: fix return value check in evm_write_xattrs()
  2018-07-11 15:15 ` Serge E. Hallyn
@ 2018-07-22 23:38   ` Mimi Zohar
  0 siblings, 0 replies; 3+ messages in thread
From: Mimi Zohar @ 2018-07-22 23:38 UTC (permalink / raw)
  To: Serge E. Hallyn, Wei Yongjun
  Cc: Mimi Zohar, James Morris, Matthew Garrett, linux-integrity,
	linux-security-module, kernel-janitors

On Wed, 2018-07-11 at 10:15 -0500, Serge E. Hallyn wrote:
> Quoting Wei Yongjun (weiyongjun1@huawei.com):
> > In case of error, the function audit_log_start() returns NULL pointer
> > not ERR_PTR(). The IS_ERR() test in the return value check should be
> > replaced with NULL test.
> > 
> > Fixes: fa516b66a1bf ("EVM: Allow runtime modification of the set of verified xattrs")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Acked-by: Serge Hallyn <serge@hallyn.com>

Thanks, this patch is now queued in the next-integrity branch of the
linux-integrity tree.

Mimi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-23  0:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 13:28 [PATCH -next] EVM: fix return value check in evm_write_xattrs() Wei Yongjun
2018-07-11 15:15 ` Serge E. Hallyn
2018-07-22 23:38   ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).