Commit a983dd5d authored by Eli Billauer's avatar Eli Billauer Committed by Greg Kroah-Hartman

staging: xillybus: Non-interruptible mutex_lock() on release method

Responding to an interrupt while handling the "release" method can't end
well anyhow. In practical cases, this can force the user to wait up to
one second while flushing remaining data is attempted (a timeout on the flush
mechanism limits the time for flushing).
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarEli Billauer <eli.billauer@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3cbc7479
...@@ -1588,7 +1588,6 @@ static int xillybus_open(struct inode *inode, struct file *filp) ...@@ -1588,7 +1588,6 @@ static int xillybus_open(struct inode *inode, struct file *filp)
static int xillybus_release(struct inode *inode, struct file *filp) static int xillybus_release(struct inode *inode, struct file *filp)
{ {
int rc;
unsigned long flags; unsigned long flags;
struct xilly_channel *channel = filp->private_data; struct xilly_channel *channel = filp->private_data;
...@@ -1599,13 +1598,7 @@ static int xillybus_release(struct inode *inode, struct file *filp) ...@@ -1599,13 +1598,7 @@ static int xillybus_release(struct inode *inode, struct file *filp)
return -EIO; return -EIO;
if (filp->f_mode & FMODE_WRITE) { if (filp->f_mode & FMODE_WRITE) {
rc = mutex_lock_interruptible(&channel->rd_mutex); mutex_lock(&channel->rd_mutex);
if (rc) {
dev_warn(channel->endpoint->dev,
"Failed to close file. Hardware left in messy state.\n");
return rc;
}
channel->rd_ref_count--; channel->rd_ref_count--;
...@@ -1625,12 +1618,7 @@ static int xillybus_release(struct inode *inode, struct file *filp) ...@@ -1625,12 +1618,7 @@ static int xillybus_release(struct inode *inode, struct file *filp)
} }
if (filp->f_mode & FMODE_READ) { if (filp->f_mode & FMODE_READ) {
rc = mutex_lock_interruptible(&channel->wr_mutex); mutex_lock(&channel->wr_mutex);
if (rc) {
dev_warn(channel->endpoint->dev,
"Failed to close file. Hardware left in messy state.\n");
return rc;
}
channel->wr_ref_count--; channel->wr_ref_count--;
......
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