Messages in this thread | | | From | Linus Torvalds <> | Date | Wed, 19 Sep 2012 16:01:50 -0700 | Subject | Re: 3.6rc6 slab corruption. |
| |
On Wed, Sep 19, 2012 at 2:49 PM, David Rientjes <rientjes@google.com> wrote: > > An alternative to this, though, might be to never test for *ppos == 0 in > u32_array_read() and do the format_array_alloc() in u32_array_open() to > initialize file->private_data. If that allocation fails, just return > -ENOMEM. Then you never need to add a mutex in the read path. > > Any reason we can't do this?
That does look simpler, and avoiding the lock is a good idea. Since we don't support lseek() (or pread/pwrite) on that thing anyway, there's no way to keep the fd open and just re-use it to read the data over and over, so populating it at open time sounds like a good solution with no real downsides.
Linus
| |