aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-26 21:35:48 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:10:08 -0400
commitbdbf69437a5ae6f820a6d3aa8c6e3c3ce7e6e05f (patch)
tree32ef1bc8863953cfc9abb6ef6de79cf7fea7088c /sound
parent4109633f4c4dcdaedf0d85ae74dba334760c577b (diff)
switch SNDRV_PCM_IOCTL_LINK to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_native.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 53b5ada8f7c3..20554eff5a21 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1563,25 +1563,25 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
1563 1563
1564 1564
1565/* WARNING: Don't forget to fput back the file */ 1565/* WARNING: Don't forget to fput back the file */
1566static struct file *snd_pcm_file_fd(int fd) 1566static struct file *snd_pcm_file_fd(int fd, int *fput_needed)
1567{ 1567{
1568 struct file *file; 1568 struct file *file;
1569 struct inode *inode; 1569 struct inode *inode;
1570 unsigned int minor; 1570 unsigned int minor;
1571 1571
1572 file = fget(fd); 1572 file = fget_light(fd, fput_needed);
1573 if (!file) 1573 if (!file)
1574 return NULL; 1574 return NULL;
1575 inode = file->f_path.dentry->d_inode; 1575 inode = file->f_path.dentry->d_inode;
1576 if (!S_ISCHR(inode->i_mode) || 1576 if (!S_ISCHR(inode->i_mode) ||
1577 imajor(inode) != snd_major) { 1577 imajor(inode) != snd_major) {
1578 fput(file); 1578 fput_light(file, *fput_needed);
1579 return NULL; 1579 return NULL;
1580 } 1580 }
1581 minor = iminor(inode); 1581 minor = iminor(inode);
1582 if (!snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) && 1582 if (!snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) &&
1583 !snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE)) { 1583 !snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE)) {
1584 fput(file); 1584 fput_light(file, *fput_needed);
1585 return NULL; 1585 return NULL;
1586 } 1586 }
1587 return file; 1587 return file;
@@ -1597,8 +1597,9 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
1597 struct snd_pcm_file *pcm_file; 1597 struct snd_pcm_file *pcm_file;
1598 struct snd_pcm_substream *substream1; 1598 struct snd_pcm_substream *substream1;
1599 struct snd_pcm_group *group; 1599 struct snd_pcm_group *group;
1600 int fput_needed;
1600 1601
1601 file = snd_pcm_file_fd(fd); 1602 file = snd_pcm_file_fd(fd, &fput_needed);
1602 if (!file) 1603 if (!file)
1603 return -EBADFD; 1604 return -EBADFD;
1604 pcm_file = file->private_data; 1605 pcm_file = file->private_data;
@@ -1633,7 +1634,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
1633 write_unlock_irq(&snd_pcm_link_rwlock); 1634 write_unlock_irq(&snd_pcm_link_rwlock);
1634 up_write(&snd_pcm_link_rwsem); 1635 up_write(&snd_pcm_link_rwsem);
1635 _nolock: 1636 _nolock:
1636 fput(file); 1637 fput_light(file, fput_needed);
1637 if (res < 0) 1638 if (res < 0)
1638 kfree(group); 1639 kfree(group);
1639 return res; 1640 return res;