diff options
author | Vasiliy Kulikov <segooon@gmail.com> | 2010-10-10 13:28:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-09 16:24:13 -0500 |
commit | ea07a9f2557b8ea99a0cdd778a5d94a7495bb049 (patch) | |
tree | f90e84e0fd92803297814adbc04ec43ca8a7d1d2 | |
parent | c888d4e7b2644c7ff17098b0b521c29b98e0abd0 (diff) |
staging: stradis: fix error handling and information leak to userland
configure_saa7146() didn't free irq on error.
saa_open() didn't decrease reference count of saa on error.
saa_ioctl() leaked information from the kernel stack to userland as it
didn't fill copied structs with zeros.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/stradis/stradis.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/staging/stradis/stradis.c b/drivers/staging/stradis/stradis.c index a057824e7ebc..807dd7eb748f 100644 --- a/drivers/staging/stradis/stradis.c +++ b/drivers/staging/stradis/stradis.c | |||
@@ -1286,6 +1286,7 @@ static long saa_ioctl(struct file *file, | |||
1286 | case VIDIOCGCAP: | 1286 | case VIDIOCGCAP: |
1287 | { | 1287 | { |
1288 | struct video_capability b; | 1288 | struct video_capability b; |
1289 | memset(&b, 0, sizeof(b)); | ||
1289 | strcpy(b.name, saa->video_dev.name); | 1290 | strcpy(b.name, saa->video_dev.name); |
1290 | b.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY | | 1291 | b.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY | |
1291 | VID_TYPE_CLIPPING | VID_TYPE_FRAMERAM | | 1292 | VID_TYPE_CLIPPING | VID_TYPE_FRAMERAM | |
@@ -1416,6 +1417,7 @@ static long saa_ioctl(struct file *file, | |||
1416 | case VIDIOCGWIN: | 1417 | case VIDIOCGWIN: |
1417 | { | 1418 | { |
1418 | struct video_window vw; | 1419 | struct video_window vw; |
1420 | memset(&vw, 0, sizeof(vw)); | ||
1419 | vw.x = saa->win.x; | 1421 | vw.x = saa->win.x; |
1420 | vw.y = saa->win.y; | 1422 | vw.y = saa->win.y; |
1421 | vw.width = saa->win.width; | 1423 | vw.width = saa->win.width; |
@@ -1448,6 +1450,7 @@ static long saa_ioctl(struct file *file, | |||
1448 | case VIDIOCGFBUF: | 1450 | case VIDIOCGFBUF: |
1449 | { | 1451 | { |
1450 | struct video_buffer v; | 1452 | struct video_buffer v; |
1453 | memset(&v, 0, sizeof(v)); | ||
1451 | v.base = (void *)saa->win.vidadr; | 1454 | v.base = (void *)saa->win.vidadr; |
1452 | v.height = saa->win.sheight; | 1455 | v.height = saa->win.sheight; |
1453 | v.width = saa->win.swidth; | 1456 | v.width = saa->win.swidth; |
@@ -1492,6 +1495,7 @@ static long saa_ioctl(struct file *file, | |||
1492 | case VIDIOCGAUDIO: | 1495 | case VIDIOCGAUDIO: |
1493 | { | 1496 | { |
1494 | struct video_audio v; | 1497 | struct video_audio v; |
1498 | memset(&v, 0, sizeof(v)); | ||
1495 | v = saa->audio_dev; | 1499 | v = saa->audio_dev; |
1496 | v.flags &= ~(VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE); | 1500 | v.flags &= ~(VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE); |
1497 | v.flags |= VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME; | 1501 | v.flags |= VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME; |
@@ -1534,6 +1538,7 @@ static long saa_ioctl(struct file *file, | |||
1534 | case VIDIOCGUNIT: | 1538 | case VIDIOCGUNIT: |
1535 | { | 1539 | { |
1536 | struct video_unit vu; | 1540 | struct video_unit vu; |
1541 | memset(&vu, 0, sizeof(vu)); | ||
1537 | vu.video = saa->video_dev.minor; | 1542 | vu.video = saa->video_dev.minor; |
1538 | vu.vbi = VIDEO_NO_UNIT; | 1543 | vu.vbi = VIDEO_NO_UNIT; |
1539 | vu.radio = VIDEO_NO_UNIT; | 1544 | vu.radio = VIDEO_NO_UNIT; |
@@ -1888,6 +1893,7 @@ static int saa_open(struct file *file) | |||
1888 | 1893 | ||
1889 | saa->user++; | 1894 | saa->user++; |
1890 | if (saa->user > 1) { | 1895 | if (saa->user > 1) { |
1896 | saa->user--; | ||
1891 | unlock_kernel(); | 1897 | unlock_kernel(); |
1892 | return 0; /* device open already, don't reset */ | 1898 | return 0; /* device open already, don't reset */ |
1893 | } | 1899 | } |
@@ -2000,10 +2006,13 @@ static int __devinit configure_saa7146(struct pci_dev *pdev, int num) | |||
2000 | if (retval < 0) { | 2006 | if (retval < 0) { |
2001 | dev_err(&pdev->dev, "%d: error in registering video device!\n", | 2007 | dev_err(&pdev->dev, "%d: error in registering video device!\n", |
2002 | num); | 2008 | num); |
2003 | goto errio; | 2009 | goto errirq; |
2004 | } | 2010 | } |
2005 | 2011 | ||
2006 | return 0; | 2012 | return 0; |
2013 | |||
2014 | errirq: | ||
2015 | free_irq(saa->irq, saa); | ||
2007 | errio: | 2016 | errio: |
2008 | iounmap(saa->saa7146_mem); | 2017 | iounmap(saa->saa7146_mem); |
2009 | err: | 2018 | err: |