mirror of https://gitee.com/openkylin/linux.git
Staging fixes for 4.16-rc6
Here are 3 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. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWqkHLA8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+yke8QCgu2O8UVv/6vfXr9LFoLibALbHVI0An1HMLGiw KcRNTYaF0cBGBCrnPPa+ =h5d2 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
5e15d39f1e
|
@ -326,24 +326,23 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)
|
|||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
if (asma->size == 0) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!asma->file) {
|
||||
ret = -EBADF;
|
||||
goto out;
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
ret = vfs_llseek(asma->file, offset, origin);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
/** Copy f_pos from backing file, since f_ops->llseek() sets it */
|
||||
file->f_pos = asma->file->f_pos;
|
||||
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -702,16 +701,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
|
|||
size_t pgstart, pgend;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
|
||||
return -EFAULT;
|
||||
|
||||
mutex_lock(&ashmem_mutex);
|
||||
|
||||
if (unlikely(!asma->file))
|
||||
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" */
|
||||
if (!pin.len)
|
||||
pin.len = PAGE_ALIGN(asma->size) - pin.offset;
|
||||
|
|
|
@ -475,8 +475,7 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s,
|
|||
struct comedi_cmd *cmd = &async->cmd;
|
||||
|
||||
if (cmd->stop_src == TRIG_COUNT) {
|
||||
unsigned int nscans = nsamples / cmd->scan_end_arg;
|
||||
unsigned int scans_left = __comedi_nscans_left(s, nscans);
|
||||
unsigned int scans_left = __comedi_nscans_left(s, cmd->stop_arg);
|
||||
unsigned int scan_pos =
|
||||
comedi_bytes_to_samples(s, async->scan_progress);
|
||||
unsigned long long samples_left = 0;
|
||||
|
|
Loading…
Reference in New Issue