Skip to contentSkip to conversation

intel-hda: fix stream search

PATCH Applied Gerd Hoffmann 5 participants 5 messages Nov 2, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel-hda: fix stream search

commit ba43d28916c4f51c19bd7366089155ce81bee058 introduces a bug:
The stream-not-found case doesn't error out any more, instead the code silently uses the first stream. Fix it.

---
 hw/intel-hda.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/intel-hda.c +1 -1
index 675b659..b7ec36d 100644
@@ -401,7 +401,7 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
             break;
         }
     }
-    if (st == NULL) {
+    if (s == 4) {
         return false;
     }
     if (st->bpl == NULL) {
Signature · 1 line
1.7.1
#2 lore raw
In reply to Gerd Hoffmann

Am 02.11.2011 12:56, schrieb Gerd Hoffmann:

Quoted 14 lines

commit ba43d28916c4f51c19bd7366089155ce81bee058 introduces a bug:
The stream-not-found case doesn't error out any more, instead the code silently uses the first stream. Fix it.

---
 hw/intel-hda.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/intel-hda.c +0 -0
index 675b659..b7ec36d 100644

hw/intel-hda.c static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output, · line 407

Quoted 8 lines
hw/intel-hda.c +1 -1
@@ -401,7 +401,7 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
             break;
         }
     }
-    if (st == NULL) {
+    if (s == 4) {
         return false;
     }
     if (st->bpl == NULL) {

The commit message doesn't say it clearly: Is st == NULL impossible? If not, this introduces a potential NULL pointer dereference at st->bpl.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw

Am 02.11.2011 13:18, schrieb Andreas Färber:

Quoted 10 lines

Am 02.11.2011 12:56, schrieb Gerd Hoffmann:

Quoted 9 lines

commit ba43d28916c4f51c19bd7366089155ce81bee058 introduces a bug:
The stream-not-found case doesn't error out any more, instead the code silently uses the first stream. Fix it.

---
 hw/intel-hda.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines

hw/intel-hda.c static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output, · line 407

Quoted 13 lines
hw/intel-hda.c +1 -1
index 675b659..b7ec36d 100644
@@ -401,7 +401,7 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
             break;
         }
     }
-    if (st == NULL) {
+    if (s == 4) {
         return false;
     }
     if (st->bpl == NULL) {

The commit message doesn't say it clearly: Is st == NULL impossible? If not, this introduces a potential NULL pointer dereference at st->bpl.

Yes, it's impossible. This is the full context:

    st = output ? d->st + 4 : d->st;
    for (s = 0; s < 4; s++) {
        if (stnr == ((st[s].ctl >> 20) & 0x0f)) {
            st = st + s;
            break;
        }
    }

d->st is an array: IntelHDAStream st[8];

Kevin

#4 lore raw
In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann

commit ba43d28916c4f51c19bd7366089155ce81bee058 introduces a bug:
The stream-not-found case doesn't error out any more, instead the code silently uses the first stream. Fix it.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 17 lines
---
  hw/intel-hda.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
hw/intel-hda.c +1 -1
index 675b659..b7ec36d 100644
@@ -401,7 +401,7 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
              break;
          }
      }
-    if (st == NULL) {
+    if (s == 4) {
          return false;
      }
      if (st->bpl == NULL) {