Skip to contentSkip to conversation

DSPBRIDGE: dont pass invalid DSP OPP requests

PATCH In review Nishanth Menon 4 participants 4 messages Jan 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DSPBRIDGE: dont pass invalid DSP OPP requests

If DSP baseimage requests for invalid OPPs, do not pass them to the rest of the linux kernel subsystem. with a test baseimage it was found to send
IO_DispatchPM: WMDIOCTL_CONSTRAINT_REQUEST with parameter 0. this is an invalid OPP ID and should not be passed anywhere. we add a param check for this prior to passing it along to the workqueue.

Cc Ameya Palande <[email protected]>
Cc Deepak Chitriki <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Hiroshi Doyu <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/wmd/io_sm.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +6 -3
index 6c140c5..618bedb 100644
@@ -960,9 +960,12 @@ static void IO_DispatchPM(struct work_struct *work)
 			pArg[1] = pIOMgr->pSharedMem->oppRequest.rqstOppPt;
 			DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Value of OPP "
 				 "value =0x%x \n", pArg[1]);
-			status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
-				 hWmdContext, WMDIOCTL_CONSTRAINT_REQUEST,
-				 pArg);
+			if (!pArg[1])
+				status = DSP_EINVALIDARG;
+			else
+				status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
+					 hWmdContext,
+					 WMDIOCTL_CONSTRAINT_REQUEST, pArg);
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Failed "
 					 "to set constraint = 0x%x \n",
Signature · 1 line
1.6.3.3
#1 lore raw

Hi Nishanth,

Quoted 29 lines · ext Nishanth Menon

If DSP baseimage requests for invalid OPPs, do not pass them to the rest of the linux kernel subsystem. with a test baseimage it was found to send
IO_DispatchPM: WMDIOCTL_CONSTRAINT_REQUEST with parameter 0. this is an invalid OPP ID and should not be passed anywhere. we add a param check for this prior to passing it along to the workqueue.

Cc Ameya Palande <[email protected]>
Cc Deepak Chitriki <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Hiroshi Doyu <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/wmd/io_sm.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -2
index 6c140c5..618bedb 100644
@@ -960,9 +960,12 @@ static void IO_DispatchPM(struct work_struct *work)
 			pArg[1] = pIOMgr->pSharedMem->oppRequest.rqstOppPt;
 			DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Value of OPP "
 				 "value =0x%x \n", pArg[1]);
-			status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
-				 hWmdContext, WMDIOCTL_CONSTRAINT_REQUEST,

drivers/dsp/bridge/wmd/io_sm.c static void IO_DispatchPM(struct work_struct *work) · line 971

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -1
-				 pArg);
+			if (!pArg[1])
+				status = DSP_EINVALIDARG;
+			else
+				status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
+					 hWmdContext,
+					 WMDIOCTL_CONSTRAINT_REQUEST, pArg);
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Failed "
 					 "to set constraint = 0x%x \n",

Instead of checking just for 0, isn't it better to check for any value outside of valid OPPs? (Especially if we need robust implementation which shouldn't break because of DSP BIOS blackbox!).

Cheers,
Ameya.

#2 lore raw

Ameya Palande said the following on 01/20/2010 04:01 AM:

Quoted 40 lines

Hi Nishanth,

Quoted 36 lines · ext Nishanth Menon

If DSP baseimage requests for invalid OPPs, do not pass them to the rest of the linux kernel subsystem. with a test baseimage it was found to send
IO_DispatchPM: WMDIOCTL_CONSTRAINT_REQUEST with parameter 0. this is an invalid OPP ID and should not be passed anywhere. we add a param check for this prior to passing it along to the workqueue.

Cc Ameya Palande <[email protected]>
Cc Deepak Chitriki <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Hiroshi Doyu <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/wmd/io_sm.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +6 -3
index 6c140c5..618bedb 100644
@@ -960,9 +960,12 @@ static void IO_DispatchPM(struct work_struct *work)
 			pArg[1] = pIOMgr->pSharedMem->oppRequest.rqstOppPt;
 			DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Value of OPP "
 				 "value =0x%x \n", pArg[1]);
-			status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
-				 hWmdContext, WMDIOCTL_CONSTRAINT_REQUEST,
-				 pArg);
+			if (!pArg[1])
+				status = DSP_EINVALIDARG;
+			else
+				status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
+					 hWmdContext,
+					 WMDIOCTL_CONSTRAINT_REQUEST, pArg);
Quoted 10 lines

drivers/dsp/bridge/wmd/io_sm.c static void IO_DispatchPM(struct work_struct *work) · line 971

Quoted 4 lines
drivers/dsp/bridge/wmd/io_sm.c +0 -0
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Failed "
 					 "to set constraint = 0x%x \n",

Instead of checking just for 0, isn't it better to check for any value outside of valid OPPs? (Especially if we need robust implementation which shouldn't break because of DSP BIOS blackbox!).

yeah, i agree. should check for the max level also. dropping this and will resend. Regards,
Nishanth Menon

#3 lore raw
Quoted 51 lines

From: Nishanth Menon on Wednesday, January 20, 2010 6:02 AM

Ameya Palande said the following on 01/20/2010 04:01 AM:

Quoted 48 lines

Hi Nishanth,

Quoted 30 lines · ext Nishanth Menon

If DSP baseimage requests for invalid OPPs, do not pass them to the rest of the linux kernel subsystem. with a test baseimage it was found to send
IO_DispatchPM: WMDIOCTL_CONSTRAINT_REQUEST with parameter 0. this is an invalid OPP ID and should not be passed anywhere. we add a param check for this prior to passing it along to the workqueue.

Cc Ameya Palande <[email protected]>
Cc Deepak Chitriki <[email protected]>
Cc Felipe Contreras <[email protected]>
Cc Hiroshi Doyu <[email protected]>
Cc Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/wmd/io_sm.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/dsp/bridge/wmd/io_sm.c +0 -2
index 6c140c5..618bedb 100644
@@ -960,9 +960,12 @@ static void IO_DispatchPM(struct work_struct *work)
 			pArg[1] = pIOMgr->pSharedMem->oppRequest.rqstOppPt;
 			DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Value of OPP "
 				 "value =0x%x \n", pArg[1]);
-			status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
-				 hWmdContext, WMDIOCTL_CONSTRAINT_REQUEST,

drivers/dsp/bridge/wmd/io_sm.c static void IO_DispatchPM(struct work_struct *work) · line 971

Quoted 10 lines
drivers/dsp/bridge/wmd/io_sm.c +6 -1
-				 pArg);
+			if (!pArg[1])
+				status = DSP_EINVALIDARG;
+			else
+				status = pIOMgr->pIntfFxns->pfnDevCntrl(pIOMgr->
+					 hWmdContext,
+					 WMDIOCTL_CONSTRAINT_REQUEST, pArg);
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7, "IO_DispatchPM : Failed "
 					 "to set constraint = 0x%x \n",

Instead of checking just for 0, isn't it better to check for any value outside of valid OPPs? (Especially if we need robust implementation which shouldn't break because of DSP BIOS blackbox!).

Dsp will ask only for the opps programmed to the shared memory... so no need, as long as the shared memory is filled with the right values.

Quoted 4 lines
Quoted 2 lines

yeah, i agree. should check for the max level also. dropping this and will resend.

Dsp doesn't request opp 0 to kernel.

- omar