lkml.org 
[lkml]   [2013]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[095/251] staging: android: logger: Correct write offset reset on error
    3.6.11.9-rc1 stable review patch.
    If anyone has any objections, please let me know.

    ------------------

    From: Karlis Ogsts <karlis.ogsts@sonymobile.com>

    [ Upstream commit 72bb99cfe9c57d2044445fb34bbc95b4c0bae6f2 ]

    In the situation that a writer fails to copy data from userspace it will reset
    the write offset to the value it had before it went to sleep. This discarding
    any messages written while aquiring the mutex.

    Therefore the reset offset needs to be retrieved after acquiring the mutex.

    Cc: Android Kernel Team <kernel-team@android.com>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    drivers/staging/android/logger.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
    index f7b8237d5..e5b797c 100644
    --- a/drivers/staging/android/logger.c
    +++ b/drivers/staging/android/logger.c
    @@ -359,7 +359,7 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,
    unsigned long nr_segs, loff_t ppos)
    {
    struct logger_log *log = file_get_log(iocb->ki_filp);
    - size_t orig = log->w_off;
    + size_t orig;
    struct logger_entry header;
    struct timespec now;
    ssize_t ret = 0;
    @@ -378,6 +378,8 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov,

    mutex_lock(&log->mutex);

    + orig = log->w_off;
    +
    /*
    * Fix up any readers, pulling them forward to the first readable
    * entry after (what will be) the new write offset. We do this now
    --
    1.7.10.4



    \
     
     \ /
      Last update: 2013-09-12 01:41    [W:2.369 / U:0.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site