public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea <mariofutire@googlemail.com>
To: linux-dvb@linuxtv.org
Subject: [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush
Date: Sat, 22 Mar 2008 00:22:06 +0000	[thread overview]
Message-ID: <47E4512E.5000602@googlemail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

I've been playing with DMX_SET_BUFFER_SIZE and I've had a problem when I tried to resize the buffer
to a smaller size.

dvb_dmxdev_set_buffer_size flushes the ringbuffer and then replaces it with a new one.
What happens if the current pointer is on a position that would be invalid in the new buffer? An
access violation.

This because dvb_ringbuffer_flush resets the 2 pointers to the vaule of pwrite (which could be after
the end of the new buffer).
I think it is safer to reset them to 0.

Andrea


[-- Attachment #2: ring.diff --]
[-- Type: text/x-patch, Size: 454 bytes --]

diff -r 1886a5ea2f84 linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
--- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Fri Mar 21 08:04:55 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Sat Mar 22 00:07:53 2008 +0000
@@ -86,7 +86,7 @@ ssize_t dvb_ringbuffer_avail(struct dvb_
 
 void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
 {
-	rbuf->pread = rbuf->pwrite;
+	rbuf->pread = rbuf->pwrite = 0;
 	rbuf->error = 0;
 }
 


[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

             reply	other threads:[~2008-03-22  0:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22  0:22 Andrea [this message]
2008-03-22  3:56 ` [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush Oliver Endriss
     [not found] <mailman.1.1206183601.26852.linux-dvb@linuxtv.org>
2008-03-22 11:32 ` Andrea
2008-04-13  9:30   ` Andrea
2008-04-13  9:49     ` Andrea
2008-04-14 19:51       ` Andrea
2008-04-22 18:54         ` Oliver Endriss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47E4512E.5000602@googlemail.com \
    --to=mariofutire@googlemail.com \
    --cc=linux-dvb@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox