lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090601222105.16e20612.akpm@linux-foundation.org>
Date:	Mon, 1 Jun 2009 22:21:05 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Jiri Slaby <jirislaby@...il.com>
Cc:	vibi_sreenivasan@....com, Mimi Zohar <zohar@...ibm.com>,
	Kylene Hall <kylene@...ibm.com>,
	Serge Hallyn <serue@...ibm.com>,
	Reiner Sailer <sailer@...son.ibm.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	James Morris <jmorris@...ei.org>
Subject: Re: [PATCH]:RESEND : Return proper error value on failure of
 dentry_open

On Mon, 01 Jun 2009 10:39:58 +0200 Jiri Slaby <jirislaby@...il.com> wrote:

> On 06/01/2009 10:27 AM, vibi sreenivasan wrote:
> > --- a/security/integrity/ima/ima_main.c
> > +++ b/security/integrity/ima/ima_main.c
> > @@ -201,10 +201,10 @@ int ima_path_check(struct path *path, int mask)
> >  	}
> >  out:
> >  	mutex_unlock(&iint->mutex);
> > -	if (file)
> > +	if (!IS_ERR(file))
> >  		fput(file);
> 
> No, IS_ERR won't catch NULL and there is 'file = NULL' on the
> dentry_open fail path. I still think 'if (file)' is proper condition.
> 
> What bug did you hit?

	if (!(iint->flags & IMA_MEASURED)) {
		struct dentry *dentry = dget(path->dentry);
		struct vfsmount *mnt = mntget(path->mnt);

		file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE,
				   current_cred());
		if (IS_ERR(file)) {
			pr_info("%s dentry_open failed\n", dentry->d_name.name);
			rc = PTR_ERR(file);
			file = NULL;
			goto out;
		}
		rc = get_path_measurement(iint, file, dentry->d_name.name);
	}
out:
	mutex_unlock(&iint->mutex);
	if (file)
		fput(file);
	kref_put(&iint->refcount, iint_free);
	return 0;
}

The handling of `file' looks OK to me.

otoh the function just drops the error code on the floor.  Shouldn't it
return `rc'?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ