From 0023f2c049be0666b78ac6e30b487871010d1f59 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 27 Aug 2012 12:54:13 -0400 Subject: [PATCH] --- yaml --- r: 329007 b: refs/heads/master c: 78f7d75e5dd9aa1027e90d0b71d394603933c2ed h: refs/heads/master i: 329005: 8c0e2e0f66e7d5e5b562efc8c07c3c42d8d55ab1 329003: 2c4e7f41e2cecf95b0cb5e65f3ea11a23d64b66a 328999: 1a0ac2fa97a4f6648b4aa0f78ed60e313453f263 328991: 6a25c8875e4e1a5710d4c7551091527c1d630c50 v: v3 --- [refs] | 2 +- trunk/fs/coda/inode.c | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index 0d7706419216..216560db47d1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 88b428d6e191affae79b5c1f4764dfdebab9fae6 +refs/heads/master: 78f7d75e5dd9aa1027e90d0b71d394603933c2ed diff --git a/trunk/fs/coda/inode.c b/trunk/fs/coda/inode.c index f1813120d753..bd2313d106e5 100644 --- a/trunk/fs/coda/inode.c +++ b/trunk/fs/coda/inode.c @@ -109,41 +109,39 @@ static int get_device_index(struct coda_mount_data *data) { struct file *file; struct inode *inode; - int idx; + int idx, fput_needed; - if(data == NULL) { + if (data == NULL) { printk("coda_read_super: Bad mount data\n"); return -1; } - if(data->version != CODA_MOUNT_VERSION) { + if (data->version != CODA_MOUNT_VERSION) { printk("coda_read_super: Bad mount version\n"); return -1; } - file = fget(data->fd); - inode = NULL; - if(file) - inode = file->f_path.dentry->d_inode; - - if(!inode || !S_ISCHR(inode->i_mode) || - imajor(inode) != CODA_PSDEV_MAJOR) { - if(file) - fput(file); - - printk("coda_read_super: Bad file\n"); - return -1; + file = fget_light(data->fd, &fput_needed); + if (!file) + goto Ebadf; + inode = file->f_path.dentry->d_inode; + if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) { + fput_light(file, fput_needed); + goto Ebadf; } idx = iminor(inode); - fput(file); + fput_light(file, fput_needed); - if(idx < 0 || idx >= MAX_CODADEVS) { + if (idx < 0 || idx >= MAX_CODADEVS) { printk("coda_read_super: Bad minor number\n"); return -1; } return idx; +Ebadf: + printk("coda_read_super: Bad file\n"); + return -1; } static int coda_fill_super(struct super_block *sb, void *data, int silent)