Commit 5ebfcb96 authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/bk/linux-2.6.4

into intel.com:/home/lenb/src/linux-acpi-test-2.6.4
parents e93b4d70 837fd582
......@@ -186,6 +186,7 @@ Original developers of the crypto algorithms:
Dag Arne Osvik (Serpent)
Brian Gladman (AES)
Kartikey Mahendra Bhatt (CAST6)
Jon Oberheide (ARC4)
SHA1 algorithm contributors:
Jean-Francois Dive
......
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 4
EXTRAVERSION =-rc1
EXTRAVERSION =-rc2
NAME=Feisty Dunnart
# *DOCUMENTATION*
......
......@@ -23,6 +23,11 @@ CFLAGS += -mbig-endian
AS += -EB
LD += -EB
AFLAGS += -mbig-endian
else
CFLAGS += -mlittle-endian
AS += -EL
LD += -EL
AFLAGS += -mlittle-endian
endif
comma = ,
......
......@@ -187,6 +187,7 @@ EXPORT_SYMBOL(__arch_copy_from_user);
EXPORT_SYMBOL(__arch_copy_to_user);
EXPORT_SYMBOL(__arch_clear_user);
EXPORT_SYMBOL(__arch_strnlen_user);
EXPORT_SYMBOL(__arch_strncpy_from_user);
/* consistent area handling */
EXPORT_SYMBOL(consistent_alloc);
......
......@@ -347,7 +347,7 @@ config CPU_BIG_ENDIAN
help
Say Y if you plan on running a kernel in big-endian mode.
Note that your board must be properly built and your board
port must properly enable and big-endian related features
port must properly enable any big-endian related features
of your chipset/board/processor.
config CPU_ICACHE_DISABLE
......
......@@ -100,14 +100,13 @@ CONFIG_PARPORT_1284=y
CONFIG_PRINTER=m
CONFIG_ENVCTRL=m
CONFIG_DISPLAY7SEG=m
CONFIG_WATCHDOG_CP1XXX=m
CONFIG_WATCHDOG_RIO=m
# CONFIG_CMDLINE_BOOL is not set
#
# Generic Driver Options
#
CONFIG_FW_LOADER=m
# CONFIG_DEBUG_DRIVER is not set
#
# Graphics support
......@@ -211,7 +210,6 @@ CONFIG_BLK_DEV_CRYPTOLOOP=m
CONFIG_BLK_DEV_NBD=m
# CONFIG_BLK_DEV_RAM is not set
# CONFIG_BLK_DEV_INITRD is not set
CONFIG_DCSSBLK=m
#
# ATA/ATAPI/MFM/RLL support
......@@ -407,6 +405,8 @@ CONFIG_IEEE1394=m
#
# CONFIG_IEEE1394_VERBOSEDEBUG is not set
CONFIG_IEEE1394_OUI_DB=y
CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
#
# Device Drivers
......@@ -1638,6 +1638,8 @@ CONFIG_WATCHDOG=y
# Watchdog Device Drivers
#
CONFIG_SOFT_WATCHDOG=m
CONFIG_WATCHDOG_CP1XXX=m
CONFIG_WATCHDOG_RIO=m
#
# PCI-based Watchdog Cards
......@@ -1646,6 +1648,11 @@ CONFIG_PCIPCWATCHDOG=m
CONFIG_WDTPCI=m
CONFIG_WDT_501_PCI=y
#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=m
#
# Profiling support
#
......
......@@ -140,6 +140,16 @@ config CRYPTO_CAST6
The CAST6 encryption algorithm (synonymous with CAST-256) is
described in RFC2612.
config CRYPTO_ARC4
tristate "ARC4 cipher algorithm"
depends on CRYPTO
help
ARC4 cipher algorithm.
This is a stream cipher using keys ranging from 8 bits to 2048
bits in length. ARC4 is commonly used in protocols such as WEP
and SSL.
config CRYPTO_DEFLATE
tristate "Deflate compression algorithm"
depends on CRYPTO
......
......@@ -21,6 +21,7 @@ obj-$(CONFIG_CRYPTO_SERPENT) += serpent.o
obj-$(CONFIG_CRYPTO_AES) += aes.o
obj-$(CONFIG_CRYPTO_CAST5) += cast5.o
obj-$(CONFIG_CRYPTO_CAST6) += cast6.o
obj-$(CONFIG_CRYPTO_ARC4) += arc4.o
obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
/*
* Cryptographic API
*
* ARC4 Cipher Algorithm
*
* Jon Oberheide <jon@focalhost.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/crypto.h>
#define ARC4_MIN_KEY_SIZE 1
#define ARC4_MAX_KEY_SIZE 256
#define ARC4_BLOCK_SIZE 1
struct arc4_ctx {
u8 S[256];
u8 x, y;
};
static int arc4_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
{
struct arc4_ctx *ctx = ctx_arg;
int i, j = 0, k = 0;
ctx->x = 1;
ctx->y = 0;
for(i = 0; i < 256; i++)
ctx->S[i] = i;
for(i = 0; i < 256; i++)
{
u8 a = ctx->S[i];
j = (j + in_key[k] + a) & 0xff;
ctx->S[i] = ctx->S[j];
ctx->S[j] = a;
if(++k >= key_len)
k = 0;
}
/* TODO: dump the first 768 bytes generated as recommended
by Ilya Mironov (http://eprint.iacr.org/2002/067/) to
increase the statistical strength of the state table */
return 0;
}
static void arc4_crypt(void *ctx_arg, u8 *out, const u8 *in)
{
struct arc4_ctx *ctx = ctx_arg;
u8 *const S = ctx->S;
u8 x = ctx->x;
u8 y = ctx->y;
u8 a = S[x];
y = (y + a) & 0xff;
u8 b = S[y];
S[x] = b;
S[y] = a;
x = (x + 1) & 0xff;
*out++ = *in ^ S[(a + b) & 0xff];
ctx->x = x;
ctx->y = y;
}
static struct crypto_alg arc4_alg = {
.cra_name = "arc4",
.cra_flags = CRYPTO_ALG_TYPE_CIPHER,
.cra_blocksize = ARC4_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct arc4_ctx),
.cra_module = THIS_MODULE,
.cra_list = LIST_HEAD_INIT(arc4_alg.cra_list),
.cra_u = { .cipher = {
.cia_min_keysize = ARC4_MIN_KEY_SIZE,
.cia_max_keysize = ARC4_MAX_KEY_SIZE,
.cia_setkey = arc4_set_key,
.cia_encrypt = arc4_crypt,
.cia_decrypt = arc4_crypt } }
};
static int __init arc4_init(void)
{
return crypto_register_alg(&arc4_alg);
}
static void __exit arc4_exit(void)
{
crypto_unregister_alg(&arc4_alg);
}
module_init(arc4_init);
module_exit(arc4_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ARC4 Cipher Algorithm");
MODULE_AUTHOR("Jon Oberheide <jon@focalhost.com>");
......@@ -61,7 +61,7 @@ static char *tvmem;
static char *check[] = {
"des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish",
"twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6",
"deflate", NULL
"arc4", "deflate", NULL
};
static void
......@@ -556,6 +556,10 @@ do_test(void)
test_cipher ("cast6", MODE_ECB, ENCRYPT, cast6_enc_tv_template, CAST6_ENC_TEST_VECTORS);
test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS);
//ARC4
test_cipher ("arc4", MODE_ECB, ENCRYPT, arc4_enc_tv_template, ARC4_ENC_TEST_VECTORS);
test_cipher ("arc4x", MODE_ECB, DECRYPT, arc4_dec_tv_template, ARC4_DEC_TEST_VECTORS);
test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS);
test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS);
test_deflate();
......@@ -638,6 +642,11 @@ do_test(void)
test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS);
break;
case 16:
test_cipher ("arc4", MODE_ECB, ENCRYPT, arc4_enc_tv_template, ARC4_ENC_TEST_VECTORS);
test_cipher ("arc4", MODE_ECB, DECRYPT, arc4_dec_tv_template, ARC4_DEC_TEST_VECTORS);
break;
#ifdef CONFIG_CRYPTO_HMAC
case 100:
test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS);
......
......@@ -1488,6 +1488,147 @@ struct cipher_testvec cast5_dec_tv_template[] =
},
};
/*
* ARC4 test vectors from OpenSSL
*/
#define ARC4_ENC_TEST_VECTORS 7
#define ARC4_DEC_TEST_VECTORS 7
struct cipher_testvec arc4_enc_tv_template[] =
{
{
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.ilen = 8,
.result = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
.rlen = 8,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.ilen = 8,
.result = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
.rlen = 8,
}, {
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.klen = 8,
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.ilen = 8,
.result = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
.rlen = 8,
}, {
.key = { 0xef, 0x01, 0x23, 0x45},
.klen = 4,
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 },
.ilen = 20,
.result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
0x36, 0xb6, 0x78, 0x58 },
.rlen = 20,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78 },
.ilen = 28,
.result = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
0x40, 0x01, 0x1e, 0xcf },
.rlen = 28,
}, {
.key = { 0xef, 0x01, 0x23, 0x45 },
.klen = 4,
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00 },
.ilen = 10,
.result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
0xbd, 0x61 },
.rlen = 10,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.klen = 16,
.input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
.ilen = 8,
.result = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
.rlen = 8,
},
};
struct cipher_testvec arc4_dec_tv_template[] =
{
{
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
.ilen = 8,
.result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.rlen = 8,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
.ilen = 8,
.result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.rlen = 8,
}, {
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.klen = 8,
.input = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
.ilen = 8,
.result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.rlen = 8,
}, {
.key = { 0xef, 0x01, 0x23, 0x45},
.klen = 4,
.input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
0x36, 0xb6, 0x78, 0x58 },
.ilen = 20,
.result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 },
.rlen = 20,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
.klen = 8,
.input = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
0x40, 0x01, 0x1e, 0xcf },
.ilen = 28,
.result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
0x12, 0x34, 0x56, 0x78 },
.rlen = 28,
}, {
.key = { 0xef, 0x01, 0x23, 0x45 },
.klen = 4,
.input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
0xbd, 0x61 },
.ilen = 10,
.result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00 },
.rlen = 10,
}, {
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
.klen = 16,
.input = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
.ilen = 8,
.result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
.rlen = 8,
},
};
/*
* Compression stuff.
*/
......
This diff is collapsed.
......@@ -1812,7 +1812,6 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
return -ENOMEM;
inode->i_op = &simple_dir_inode_operations;
if (!(d = d_alloc_root (inode))) {
enomem:
iput (inode);
return -ENOMEM;
}
......@@ -1823,12 +1822,15 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
*/
dev = dev_new ();
if (!dev)
goto enomem;
return -ENOMEM;
dev->sb = sb;
if (!(inode = gadgetfs_create_file (sb, CHIP,
dev, &dev_init_operations,
&dev->dentry)))
goto enomem;
&dev->dentry))) {
put_dev(dev);
return -ENOMEM;
}
/* other endpoint files are available after hardware setup,
* from binding to a controller.
......@@ -1849,8 +1851,10 @@ static void
gadgetfs_kill_sb (struct super_block *sb)
{
kill_litter_super (sb);
put_dev (the_device);
the_device = 0;
if (the_device) {
put_dev (the_device);
the_device = 0;
}
}
/*----------------------------------------------------------------------*/
......
......@@ -135,7 +135,7 @@ static struct pci_device_id radeonfb_pci_table[] = {
CHIP_DEF(PCI_CHIP_R200_QM, R200, CHIP_HAS_CRTC2),
/* Mobility M7 */
CHIP_DEF(PCI_CHIP_RADEON_LW, RV200, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
CHIP_DEF(PCI_CHIP_RADEON_LW, RV200, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
CHIP_DEF(PCI_CHIP_RADEON_LX, RV200, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY),
/* 7500 */
CHIP_DEF(PCI_CHIP_RV200_QW, RV200, CHIP_HAS_CRTC2),
CHIP_DEF(PCI_CHIP_RV200_QX, RV200, CHIP_HAS_CRTC2),
......
......@@ -333,6 +333,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
struct object_info root_obj;
unsigned char *b_data;
struct adfs_sb_info *asb;
struct inode *root;
asb = kmalloc(sizeof(*asb), GFP_KERNEL);
if (!asb)
......@@ -443,10 +444,11 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
asb->s_namelen = ADFS_F_NAME_LEN;
}
sb->s_root = d_alloc_root(adfs_iget(sb, &root_obj));
root = adfs_iget(sb, &root_obj);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
int i;
iput(root);
for (i = 0; i < asb->s_map_size; i++)
brelse(asb->s_map[i].dm_bh);
kfree(asb->s_map);
......
......@@ -280,7 +280,6 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent)
return 0;
error:
dput(root);
iput(inode);
afs_put_volume(as->volume);
kfree(as);
......
......@@ -213,6 +213,9 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
* Get the root inode and dentry, but defer checking for errors.
*/
root_inode = autofs4_get_inode(s, autofs4_mkroot(sbi));
if (!root_inode)
goto fail_free;
root_inode->i_op = &autofs4_root_inode_operations;
root_inode->i_fop = &autofs4_root_operations;
root = d_alloc_root(root_inode);
......@@ -264,22 +267,13 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
*/
fail_fput:
printk("autofs: pipe file descriptor does not contain proper ops\n");
/*
* fput() can block, so we clear the super block first.
*/
fput(pipe);
/* fall through */
fail_dput:
/*
* dput() can block, so we clear the super block first.
*/
dput(root);
goto fail_free;
fail_iput:
printk("autofs: get root dentry failed\n");
/*
* iput() can block, so we clear the super block first.
*/
iput(root_inode);
fail_free:
kfree(sbi);
......
......@@ -789,6 +789,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
struct buffer_head *bh;
befs_sb_info *befs_sb;
befs_super_block *disk_sb;
struct inode *root;
const unsigned long sb_block = 0;
const off_t x86_sb_off = 512;
......@@ -863,9 +864,10 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
/* Set real blocksize of fs */
sb_set_blocksize(sb, (ulong) befs_sb->block_size);
sb->s_op = (struct super_operations *) &befs_sops;
sb->s_root =
d_alloc_root(iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))));
root = iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
befs_error(sb, "get root inode failed");
goto unaquire_priv_sbp;
}
......
......@@ -195,6 +195,8 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent)
printk("coda_read_super: rootinode is %ld dev %s\n",
root->i_ino, root->i_sb->s_id);
sb->s_root = d_alloc_root(root);
if (!sb->s_root)
goto error;
return 0;
error:
......
......@@ -199,6 +199,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
struct cramfs_super super;
unsigned long root_offset;
struct cramfs_sb_info *sbi;
struct inode *root;
sbi = kmalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
if (!sbi)
......@@ -263,7 +264,14 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
/* Set it all up.. */
sb->s_op = &cramfs_ops;
sb->s_root = d_alloc_root(get_cramfs_inode(sb, &super.root));
root = get_cramfs_inode(sb, &super.root);
if (!root)
goto out;
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
goto out;
}
return 0;
out:
kfree(sbi);
......
......@@ -210,6 +210,7 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
{
struct efs_sb_info *sb;
struct buffer_head *bh;
struct inode *root;
sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
if (!sb)
......@@ -266,10 +267,12 @@ int efs_fill_super(struct super_block *s, void *d, int silent)
s->s_flags |= MS_RDONLY;
}
s->s_op = &efs_superblock_operations;
s->s_root = d_alloc_root(iget(s, EFS_ROOTINODE));
root = iget(s, EFS_ROOTINODE);
s->s_root = d_alloc_root(root);
if (!(s->s_root)) {
printk(KERN_ERR "EFS: get root inode failed\n");
iput(root);
goto out_no_fs;
}
......
......@@ -563,6 +563,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
struct buffer_head * bh;
struct ext2_sb_info * sbi;
struct ext2_super_block * es;
struct inode *root;
unsigned long block, sb_block = 1;
unsigned long logic_sb_block = get_sb_block(&data);
unsigned long offset = 0;
......@@ -815,15 +816,17 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
*/
sb->s_op = &ext2_sops;
sb->s_export_op = &ext2_export_ops;
sb->s_root = d_alloc_root(iget(sb, EXT2_ROOT_INO));
if (!sb->s_root || !S_ISDIR(sb->s_root->d_inode->i_mode) ||
!sb->s_root->d_inode->i_blocks || !sb->s_root->d_inode->i_size) {
if (sb->s_root) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n");
} else
printk(KERN_ERR "EXT2-fs: get root inode failed\n");
root = iget(sb, EXT2_ROOT_INO);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
iput(root);
printk(KERN_ERR "EXT2-fs: get root inode failed\n");
goto failed_mount2;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n");
goto failed_mount2;
}
if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
......
......@@ -1040,6 +1040,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
unsigned long offset = 0;
unsigned long journal_inum = 0;
unsigned long def_mount_opts;
struct inode *root;
int blocksize;
int hblock;
int db_count;
......@@ -1354,16 +1355,17 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
* so we can safely mount the rest of the filesystem now.
*/
sb->s_root = d_alloc_root(iget(sb, EXT3_ROOT_INO));
if (!sb->s_root || !S_ISDIR(sb->s_root->d_inode->i_mode) ||
!sb->s_root->d_inode->i_blocks || !sb->s_root->d_inode->i_size) {
if (sb->s_root) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR
"EXT3-fs: corrupt root inode, run e2fsck\n");
} else
printk(KERN_ERR "EXT3-fs: get root inode failed\n");
root = iget(sb, EXT3_ROOT_INO);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
printk(KERN_ERR "EXT3-fs: get root inode failed\n");
iput(root);
goto failed_mount3;
}
if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
dput(sb->s_root);
sb->s_root = NULL;
printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n");
goto failed_mount3;
}
......
......@@ -143,6 +143,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
struct vxfs_sb *rsbp;
struct buffer_head *bp = NULL;
u_long bsize;
struct inode *root;
infp = kmalloc(sizeof(*infp), GFP_KERNEL);
if (!infp) {
......@@ -208,8 +209,10 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
}
sbp->s_op = &vxfs_super_ops;
sbp->s_root = d_alloc_root(iget(sbp, VXFS_ROOT_INO));
root = iget(sbp, VXFS_ROOT_INO);
sbp->s_root = d_alloc_root(root);
if (!sbp->s_root) {
iput(root);
printk(KERN_WARNING "vxfs: unable to get root dentry.\n");
goto out_free_ilist;
}
......
......@@ -294,13 +294,15 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root)
goto bail_no_root;
goto bail_iput;
sb->s_root->d_op = &hfs_dentry_operations;
/* everything's okay */
return 0;
bail_iput:
iput(root_inode);
bail_no_root:
hfs_warn("hfs_fs: get root inode failed.\n");
hfs_mdb_put(sb);
......
......@@ -278,6 +278,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
struct hfsplus_sb_info *sbi;
hfsplus_cat_entry entry;
struct hfs_find_data fd;
struct inode *root;
struct qstr str;
int err = -EINVAL;
......@@ -364,10 +365,12 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
}
/* Load the root directory */
sb->s_root = d_alloc_root(iget(sb, HFSPLUS_ROOT_CNID));
root = iget(sb, HFSPLUS_ROOT_CNID);
sb->s_root = d_alloc_root(root);
if (!sb->s_root) {
if (!silent)
printk("HFS+-fs: failed to load root directory\n");
iput(root);
goto cleanup;
}
......
......@@ -448,6 +448,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
struct hpfs_super_block *superblock;
struct hpfs_spare_block *spareblock;
struct hpfs_sb_info *sbi;
struct inode *root;
uid_t uid;
gid_t gid;
......@@ -613,10 +614,11 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
brelse(bh0);
hpfs_lock_iget(s, 1);
s->s_root = d_alloc_root(iget(s, sbi->sb_root));
root = iget(s, sbi->sb_root);
hpfs_unlock_iget(s);
if (!s->s_root || !s->s_root->d_inode) {
printk("HPFS: iget failed. Why???\n");
s->s_root = d_alloc_root(root);
if (!s->s_root) {
iput(root);
goto bail0;
}
hpfs_set_dentry_operations(s->s_root);
......@@ -627,22 +629,24 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
root_dno = hpfs_fnode_dno(s, sbi->sb_root);
if (root_dno)
de = map_dirent(s->s_root->d_inode, root_dno, "\001\001", 2, NULL, &qbh);
if (!root_dno || !de) hpfs_error(s, "unable to find root dir");
de = map_dirent(root, root_dno, "\001\001", 2, NULL, &qbh);
if (!de)
hpfs_error(s, "unable to find root dir");
else {
s->s_root->d_inode->i_atime.tv_sec = local_to_gmt(s, de->read_date);
s->s_root->d_inode->i_atime.tv_nsec = 0;
s->s_root->d_inode->i_mtime.tv_sec = local_to_gmt(s, de->write_date);
s->s_root->d_inode->i_mtime.tv_nsec = 0;
s->s_root->d_inode->i_ctime.tv_sec = local_to_gmt(s, de->creation_date);
s->s_root->d_inode->i_ctime.tv_nsec = 0;
hpfs_i(s->s_root->d_inode)->i_ea_size = de->ea_size;
hpfs_i(s->s_root->d_inode)->i_parent_dir = s->s_root->d_inode->i_ino;
if (s->s_root->d_inode->i_size == -1) s->s_root->d_inode->i_size = 2048;
if (s->s_root->d_inode->i_blocks == -1) s->s_root->d_inode->i_blocks = 5;
root->i_atime.tv_sec = local_to_gmt(s, de->read_date);
root->i_atime.tv_nsec = 0;
root->i_mtime.tv_sec = local_to_gmt(s, de->write_date);
root->i_mtime.tv_nsec = 0;
root->i_ctime.tv_sec = local_to_gmt(s, de->creation_date);
root->i_ctime.tv_nsec = 0;
hpfs_i(root)->i_ea_size = de->ea_size;
hpfs_i(root)->i_parent_dir = root->i_ino;
if (root->i_size == -1)
root->i_size = 2048;
if (root->i_blocks == -1)
root->i_blocks = 5;
hpfs_brelse4(&qbh);
}
if (de) hpfs_brelse4(&qbh);
return 0;
bail4: brelse(bh2);
......
......@@ -115,6 +115,7 @@ static int romfs_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head *bh;
struct romfs_super_block *rsb;
struct inode *root;
int sz;
/* I would parse the options here, but there are none.. :) */
......@@ -154,23 +155,25 @@ static int romfs_fill_super(struct super_block *s, void *data, int silent)
strnlen(rsb->name, ROMFS_MAXFN) + 1 + ROMFH_PAD)
& ROMFH_MASK;
brelse(bh);
s->s_op = &romfs_ops;
root = iget(s, sz);
if (!root)
goto out;
s->s_root = d_alloc_root(iget(s, sz));
if (!s->s_root)
goto outnobh;
goto outiput;
/* Ehrhm; sorry.. :) And thanks to Hans-Joachim Widmaier :) */
if (0) {
brelse(bh);
return 0;
outiput:
iput(root);
out:
brelse(bh);
brelse(bh);
outnobh:
return -EINVAL;
}
return 0;
return -EINVAL;
}
/* That's simple too. */
......
......@@ -461,7 +461,6 @@ asmlinkage unsigned long sys_mmap2(
unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff);
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on);
struct sigaction;
asmlinkage long sys_rt_sigaction(int sig,
const struct sigaction __user *act,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment