summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2007-05-09 02:33:36 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 12:30:49 -0700
commit84963048ca8093e0aa71ac90c2a5fe7af5f617c3 (patch)
tree336e616e2e51bcf74010d33dc331484f30676fca /drivers
parentb8cb34481edfee6692c83d3b283e29820e840280 (diff)
downloadop-kernel-dev-84963048ca8093e0aa71ac90c2a5fe7af5f617c3.zip
op-kernel-dev-84963048ca8093e0aa71ac90c2a5fe7af5f617c3.tar.gz
nbd: check the return value of sysfs_create_file
[akpm@linux-foundation.org: fix it] Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Cc: Paul Clements <paul.clements@steeleye.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/nbd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 090796b..069ae39 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -366,20 +366,25 @@ static struct disk_attribute pid_attr = {
.show = pid_show,
};
-static void nbd_do_it(struct nbd_device *lo)
+static int nbd_do_it(struct nbd_device *lo)
{
struct request *req;
+ int ret;
BUG_ON(lo->magic != LO_MAGIC);
lo->pid = current->pid;
- sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+ ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+ if (ret) {
+ printk(KERN_ERR "nbd: sysfs_create_file failed!");
+ return ret;
+ }
while ((req = nbd_read_stat(lo)) != NULL)
nbd_end_request(req);
sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr);
- return;
+ return 0;
}
static void nbd_clear_que(struct nbd_device *lo)
@@ -569,7 +574,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
case NBD_DO_IT:
if (!lo->file)
return -EINVAL;
- nbd_do_it(lo);
+ error = nbd_do_it(lo);
+ if (error)
+ return error;
/* on return tidy up in case we have a signal */
/* Forcibly shutdown the socket causing all listeners
* to error
OpenPOWER on IntegriCloud