|
@@ -543,7 +543,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
|
|
ro = curlun->initially_ro;
|
|
ro = curlun->initially_ro;
|
|
if (!ro) {
|
|
if (!ro) {
|
|
filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
|
|
filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0);
|
|
- if (-EROFS == PTR_ERR(filp))
|
|
|
|
|
|
+ if (PTR_ERR(filp) == -EROFS || PTR_ERR(filp) == -EACCES)
|
|
ro = 1;
|
|
ro = 1;
|
|
}
|
|
}
|
|
if (ro)
|
|
if (ro)
|
|
@@ -558,10 +558,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
|
|
|
|
|
|
if (filp->f_path.dentry)
|
|
if (filp->f_path.dentry)
|
|
inode = filp->f_path.dentry->d_inode;
|
|
inode = filp->f_path.dentry->d_inode;
|
|
- if (inode && S_ISBLK(inode->i_mode)) {
|
|
|
|
- if (bdev_read_only(inode->i_bdev))
|
|
|
|
- ro = 1;
|
|
|
|
- } else if (!inode || !S_ISREG(inode->i_mode)) {
|
|
|
|
|
|
+ if (!inode || (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
|
|
LINFO(curlun, "invalid file type: %s\n", filename);
|
|
LINFO(curlun, "invalid file type: %s\n", filename);
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|