Re: Linux 2.4.4-ac13

From: Francois Romieu (romieu@cogenit.fr)
Date: Tue May 22 2001 - 17:09:00 EST


Alan Cox <laughing@shared-source.org> écrit :
[...]
> o Add missing locking to stradis driver (me)

- unbalanced returns after down();
- 1770: if the initial version isn't racy with saa7146_irq (line 534), this
  one is equivalent and shorter.

init_saa7146:2185
        if ((saa->dmadebi = kmalloc(32768 + 4096, GFP_KERNEL)) == NULL)
[...]
looks suspect if the next vmalloc fail. Btw, I don't get the author
idea behind the whole "if (foo->bar == null) { foo->bar = vmalloc(...)}"
thing (chainsaw ?).

Fine against 2.4.4-ac14.

--- linux-2.4.4-ac13.orig/drivers/media/video/stradis.c Tue May 22 16:40:01 2001
+++ linux-2.4.4-ac13/drivers/media/video/stradis.c Tue May 22 17:31:48 2001
@@ -1513,8 +1513,10 @@ out:
                                          SAA7146_MC1);
                         } else {
                                 if (saa->win.vidadr == 0 || saa->win.width == 0
- || saa->win.height == 0)
+ || saa->win.height == 0) {
+ up(&saa->sem);
                                         return -EINVAL;
+ }
                                 saa->cap |= 1;
                                 saawrite((SAA7146_MC1_TR_E_1 << 16) | 0xffff,
                                          SAA7146_MC1);
@@ -1770,16 +1772,18 @@ out:
                                         if (saa->endmarktail <
                                                 saa->endmarkhead) {
                                                 if (saa->endmarkhead -
- saa->endmarktail < 2)
+ saa->endmarktail < 2) {
+ up(&saa->sem);
                                                         return -ENOSPC;
- } else if (saa->endmarkhead <=
- saa->endmarktail) {
+ }
+ } else {
                                                 if (saa->endmarktail -
                                                         saa->endmarkhead >
- (MAX_MARKS - 2))
+ (MAX_MARKS - 2)) {
+ up(&saa->sem);
                                                         return -ENOSPC;
- } else
- return -ENOSPC;
+ }
+ }
                                         saa->endmark[saa->endmarktail] =
                                                 saa->audtail;
                                         saa->endmarktail++;
@@ -1928,8 +1932,10 @@ static long saa_write(struct video_devic
                                 saa->audtail = 0;
                         }
                         if (copy_from_user(saa->audbuf + saa->audtail, buf,
- blocksize))
- return -EFAULT;
+ blocksize)) {
+ count = -EFAULT;
+ goto out;
+ }
                         saa->audtail += blocksize;
                         todo -= blocksize;
                         buf += blocksize;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:49 EST