Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618072 > unrolled thread

[PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

Started byzhangshuxiaomi@gmail.com
First post2017-04-06 16:40 +0200
Last post2017-04-06 19:30 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK. zhangshuxiaomi@gmail.com - 2017-04-06 16:40 +0200
    Re: [PATCH] staging: android: ashmem: lseek failed due to no  FMODE_LSEEK. Greg Hackmann <ghackmann@google.com> - 2017-04-06 17:40 +0200
      Re: [PATCH] staging: android: ashmem: lseek failed due to no  FMODE_LSEEK. Greg KH <gregkh@linuxfoundation.org> - 2017-04-06 19:10 +0200
        Re: [PATCH] staging: android: ashmem: lseek failed due to no  FMODE_LSEEK. Greg Hackmann <ghackmann@google.com> - 2017-04-06 19:30 +0200

#1618072 — [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

Fromzhangshuxiaomi@gmail.com
Date2017-04-06 16:40 +0200
Subject[PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
Message-ID<ttgJQ-1sw-7@gated-at.bofh.it>
From: zhangshuxiao <zhangshuxiao@xiaomi.com>

vfs_llseek will check whether the file mode has
FMODE_LSEEK, no return failure. But ashmem can be
lseek, so add FMODE_LSEEK to ashmem file.

Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
Tested-by: Greg Hackmann <ghackmann@google.com>
---
 drivers/staging/android/ashmem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 3f11332..e4530ac 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 			ret = PTR_ERR(vmfile);
 			goto out;
 		}
+		vmfile->f_mode |= FMODE_LSEEK;
 		asma->file = vmfile;
 	}
 	get_file(asma->file);
-- 
1.9.1

[toc] | [next] | [standalone]


#1618114 — Re: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

FromGreg Hackmann <ghackmann@google.com>
Date2017-04-06 17:40 +0200
SubjectRe: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
Message-ID<tthFT-2qx-1@gated-at.bofh.it>
In reply to#1618072
On 04/06/2017 07:30 AM, zhangshuxiaomi@gmail.com wrote:
> From: zhangshuxiao <zhangshuxiao@xiaomi.com>
>
> vfs_llseek will check whether the file mode has
> FMODE_LSEEK, no return failure. But ashmem can be
> lseek, so add FMODE_LSEEK to ashmem file.
>
> Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
> Tested-by: Greg Hackmann <ghackmann@google.com>
> ---
>  drivers/staging/android/ashmem.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 3f11332..e4530ac 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>  			ret = PTR_ERR(vmfile);
>  			goto out;
>  		}
> +		vmfile->f_mode |= FMODE_LSEEK;
>  		asma->file = vmfile;
>  	}
>  	get_file(asma->file);
>

This commit message is missing some important context.

ashmem_llseek() passes the llseek() call through to the backing shmem 
file.  91360b02ab48 ("ashmem: use vfs_llseek()") changed this from 
directly calling the file's llseek() op into a VFS layer call.  This 
also adds a check for the FMODE_LSEEK bit, so without that bit 
ashmem_llseek() now always fails with -ESPIPE.

I've tested that this patch fixes the regression on both hikey running 
AOSP and User Mode Linux running Debian.

[toc] | [prev] | [next] | [standalone]


#1618197 — Re: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-04-06 19:10 +0200
SubjectRe: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
Message-ID<ttj50-3IL-13@gated-at.bofh.it>
In reply to#1618114
On Thu, Apr 06, 2017 at 08:30:40AM -0700, Greg Hackmann wrote:
> On 04/06/2017 07:30 AM, zhangshuxiaomi@gmail.com wrote:
> > From: zhangshuxiao <zhangshuxiao@xiaomi.com>
> > 
> > vfs_llseek will check whether the file mode has
> > FMODE_LSEEK, no return failure. But ashmem can be
> > lseek, so add FMODE_LSEEK to ashmem file.
> > 
> > Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
> > Tested-by: Greg Hackmann <ghackmann@google.com>
> > ---
> >  drivers/staging/android/ashmem.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> > index 3f11332..e4530ac 100644
> > --- a/drivers/staging/android/ashmem.c
> > +++ b/drivers/staging/android/ashmem.c
> > @@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
> >  			ret = PTR_ERR(vmfile);
> >  			goto out;
> >  		}
> > +		vmfile->f_mode |= FMODE_LSEEK;
> >  		asma->file = vmfile;
> >  	}
> >  	get_file(asma->file);
> > 
> 
> This commit message is missing some important context.
> 
> ashmem_llseek() passes the llseek() call through to the backing shmem file.
> 91360b02ab48 ("ashmem: use vfs_llseek()") changed this from directly calling
> the file's llseek() op into a VFS layer call.  This also adds a check for
> the FMODE_LSEEK bit, so without that bit ashmem_llseek() now always fails
> with -ESPIPE.
> 
> I've tested that this patch fixes the regression on both hikey running AOSP
> and User Mode Linux running Debian.

Thanks for letting me know, I'll update the changelog a bit.  How far
back does this patch need to go in stable kernel releases?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1618215 — Re: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.

FromGreg Hackmann <ghackmann@google.com>
Date2017-04-06 19:30 +0200
SubjectRe: [PATCH] staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
Message-ID<ttjom-3R8-19@gated-at.bofh.it>
In reply to#1618197
On 04/06/2017 10:08 AM, Greg KH wrote:
> On Thu, Apr 06, 2017 at 08:30:40AM -0700, Greg Hackmann wrote:
>> On 04/06/2017 07:30 AM, zhangshuxiaomi@gmail.com wrote:
>>> From: zhangshuxiao <zhangshuxiao@xiaomi.com>
>>>
>>> vfs_llseek will check whether the file mode has
>>> FMODE_LSEEK, no return failure. But ashmem can be
>>> lseek, so add FMODE_LSEEK to ashmem file.
>>>
>>> Signed-off-by: Shuxiao Zhang <zhangshuxiao@xiaomi.com>
>>> Tested-by: Greg Hackmann <ghackmann@google.com>
>>> ---
>>>  drivers/staging/android/ashmem.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
>>> index 3f11332..e4530ac 100644
>>> --- a/drivers/staging/android/ashmem.c
>>> +++ b/drivers/staging/android/ashmem.c
>>> @@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>>>  			ret = PTR_ERR(vmfile);
>>>  			goto out;
>>>  		}
>>> +		vmfile->f_mode |= FMODE_LSEEK;
>>>  		asma->file = vmfile;
>>>  	}
>>>  	get_file(asma->file);
>>>
>>
>> This commit message is missing some important context.
>>
>> ashmem_llseek() passes the llseek() call through to the backing shmem file.
>> 91360b02ab48 ("ashmem: use vfs_llseek()") changed this from directly calling
>> the file's llseek() op into a VFS layer call.  This also adds a check for
>> the FMODE_LSEEK bit, so without that bit ashmem_llseek() now always fails
>> with -ESPIPE.
>>
>> I've tested that this patch fixes the regression on both hikey running AOSP
>> and User Mode Linux running Debian.
>
> Thanks for letting me know, I'll update the changelog a bit.  How far
> back does this patch need to go in stable kernel releases?
>
> thanks,
>
> greg k-h
>

3.18 and later.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web