Commit 5e15d39f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-4.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging fixes from Greg KH:
 "Here are three staging driver fixes for 4.16-rc6

  Two of them are lockdep fixes for the ashmem driver that have been
  reported by a number of people recently. The last one is a fix for the
  comedi driver core.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-4.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: android: ashmem: Fix possible deadlock in ashmem_ioctl
  staging: comedi: fix comedi_nsamples_left.
  staging: android: ashmem: Fix lockdep issue during llseek
parents 1a7f7496 740a5759
...@@ -326,24 +326,23 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin) ...@@ -326,24 +326,23 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)
mutex_lock(&ashmem_mutex); mutex_lock(&ashmem_mutex);
if (asma->size == 0) { if (asma->size == 0) {
ret = -EINVAL; mutex_unlock(&ashmem_mutex);
goto out; return -EINVAL;
} }
if (!asma->file) { if (!asma->file) {
ret = -EBADF; mutex_unlock(&ashmem_mutex);
goto out; return -EBADF;
} }
mutex_unlock(&ashmem_mutex);
ret = vfs_llseek(asma->file, offset, origin); ret = vfs_llseek(asma->file, offset, origin);
if (ret < 0) if (ret < 0)
goto out; return ret;
/** Copy f_pos from backing file, since f_ops->llseek() sets it */ /** Copy f_pos from backing file, since f_ops->llseek() sets it */
file->f_pos = asma->file->f_pos; file->f_pos = asma->file->f_pos;
out:
mutex_unlock(&ashmem_mutex);
return ret; return ret;
} }
...@@ -702,16 +701,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, ...@@ -702,16 +701,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
size_t pgstart, pgend; size_t pgstart, pgend;
int ret = -EINVAL; int ret = -EINVAL;
if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
return -EFAULT;
mutex_lock(&ashmem_mutex); mutex_lock(&ashmem_mutex);
if (unlikely(!asma->file)) if (unlikely(!asma->file))
goto out_unlock; goto out_unlock;
if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {
ret = -EFAULT;
goto out_unlock;
}
/* per custom, you can pass zero for len to mean "everything onward" */ /* per custom, you can pass zero for len to mean "everything onward" */
if (!pin.len) if (!pin.len)
pin.len = PAGE_ALIGN(asma->size) - pin.offset; pin.len = PAGE_ALIGN(asma->size) - pin.offset;
......
...@@ -475,8 +475,7 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s, ...@@ -475,8 +475,7 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s,
struct comedi_cmd *cmd = &async->cmd; struct comedi_cmd *cmd = &async->cmd;
if (cmd->stop_src == TRIG_COUNT) { if (cmd->stop_src == TRIG_COUNT) {
unsigned int nscans = nsamples / cmd->scan_end_arg; unsigned int scans_left = __comedi_nscans_left(s, cmd->stop_arg);
unsigned int scans_left = __comedi_nscans_left(s, nscans);
unsigned int scan_pos = unsigned int scan_pos =
comedi_bytes_to_samples(s, async->scan_progress); comedi_bytes_to_samples(s, async->scan_progress);
unsigned long long samples_left = 0; unsigned long long samples_left = 0;
......
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