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: <20130907144118.GA13318@ZenIV.linux.org.uk>
Date:	Sat, 7 Sep 2013 15:41:18 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Marco Stornelli <marco.stornelli@...il.com>
Cc:	Vladimir Davydov <vdavydov@...allels.com>,
	linux-kernel@...r.kernel.org,
	Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 12/19] pramfs: symlink operations

On Sat, Sep 07, 2013 at 10:29:15AM +0200, Marco Stornelli wrote:
> +static int pram_readlink(struct dentry *dentry, char __user *buffer, int buflen)
> +{
> +	struct inode *inode = dentry->d_inode;
> +	struct super_block *sb = inode->i_sb;
> +	u64 block;
> +	char *blockp;
> +
> +	block = pram_find_data_block(inode, 0);
> +	blockp = pram_get_block(sb, block);
> +	return vfs_readlink(dentry, buffer, buflen, blockp);
> +}

> +static void *pram_follow_link(struct dentry *dentry, struct nameidata *nd)
> +{
> +	struct inode *inode = dentry->d_inode;
> +	struct super_block *sb = inode->i_sb;
> +	off_t block;
> +	int status;
> +	char *blockp;
> +
> +	block = pram_find_data_block(inode, 0);
> +	blockp = pram_get_block(sb, block);
> +	status = vfs_follow_link(nd, blockp);
> +	return ERR_PTR(status);
> +}

Just nd_set_link(nd, blockp) instead of that vfs_follow_link() and be
done with that; that way you can use generic_readlink() instead of
pram_readlink() *and* get lower stack footprint on traversing them.

BTW, where's the error checking?  pram_get_block()/pram_find_data_block()
seem to assume that fs image isn't corrupted and if it is... that code
will happily dereference any address.  At least range checks of some sort
in pram_get_block() (and checking if it has failed) would be a good idea...
--
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