Skip to contentSkip to conversation

bus: mhi: core: Fix null pointer access

PATCH Carl Yin(殷张成) 2 participants 2 messages Oct 28, 2020 2 messages not in the archive Arm Qualcomm mailing list

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi bbhatt:

Quoted 4 lines · bbhatt

Hi Carl,

Yes this change is needed. Good catch. I ran in to this issue as well when a dev_err() call was made with a bad MHI configuration.

[carl.yin] yes, I also meet this error with a bad MHI configuration.

Quoted 9 lines

Maybe you can explain a little more in the commit text subject?

You could say, "Fix null pointer access when parsing MHI configuration"?

Quoted 3 lines · On 2020-10-26 22:33, [email protected] wrote:

From: carl <[email protected]>

function parse_ev_cfg and parse_ch_cfg access mhi_cntrl->mhi_dev

Quoted 8 lines

Functions parse_ev_cfg() and parse_ch_cfg()

Quoted 1 line

before it is set in function mhi_register_controller,

mhi_register_controller()

Quoted 1 line

use cntrl_dev to instead mhi_dev.

use cntrl_dev instead of mhi_dev.

Quoted 2 lines

With these commit text updates,

[carl.yin] thank for words correction, for my mother language is not English, there are lots of words wrong in the commit.

Quoted 31 lines
Quoted 18 lines
---
 drivers/bus/mhi/core/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/mhi/core/init.c +1 -1
index 0ffdebde8..c6b43e90b 100644
@@ -610,7 +610,7 @@ static int parse_ev_cfg(struct mhi_controller
 *mhi_cntrl,  {
 	struct mhi_event *mhi_event;
 	const struct mhi_event_config *event_cfg;
-	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	struct device *dev = mhi_cntrl->cntrl_dev;
 	int i, num;
 
 	num = config->num_events;

drivers/bus/mhi/core/init.c static int parse_ch_cfg(struct mhi_controller · line 697

Quoted 7 lines
drivers/bus/mhi/core/init.c +1 -1
@@ -692,7 +692,7 @@ static int parse_ch_cfg(struct mhi_controller
 *mhi_cntrl,
 			const struct mhi_controller_config *config)  {
 	const struct mhi_channel_config *ch_cfg;
-	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	struct device *dev = mhi_cntrl->cntrl_dev;
 	int i;
 	u32 chan;

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

#3 lore raw
Quoted 20 lines · Carl Yin

Hi bbhatt:

Quoted 4 lines · bbhatt

Hi Carl,

Yes this change is needed. Good catch. I ran in to this issue as well when a dev_err() call was made with a bad MHI configuration.

[carl.yin] yes, I also meet this error with a bad MHI configuration.

Quoted 11 lines

Maybe you can explain a little more in the commit text subject?

You could say, "Fix null pointer access when parsing MHI configuration"?

Quoted 3 lines · On 2020-10-26 22:33, [email protected] wrote:

From: carl <[email protected]>

function parse_ev_cfg and parse_ch_cfg access mhi_cntrl->mhi_dev

Functions parse_ev_cfg() and parse_ch_cfg()

Quoted 1 line

before it is set in function mhi_register_controller,

Quoted 9 lines
Quoted 6 lines

mhi_register_controller()

Quoted 1 line

use cntrl_dev to instead mhi_dev.

use cntrl_dev instead of mhi_dev.

Quoted 2 lines

With these commit text updates,

[carl.yin] thank for words correction, for my mother language is not English, there are lots of words wrong in the commit.

Quoted 1 line

No problem.

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
---
 drivers/bus/mhi/core/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/mhi/core/init.c +1 -1
index 0ffdebde8..c6b43e90b 100644
@@ -610,7 +610,7 @@ static int parse_ev_cfg(struct mhi_controller
 *mhi_cntrl,  {
 	struct mhi_event *mhi_event;
 	const struct mhi_event_config *event_cfg;
-	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	struct device *dev = mhi_cntrl->cntrl_dev;
 	int i, num;
 
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/bus/mhi/core/init.c +0 -0
 	num = config->num_events;
@@ -692,7 +692,7 @@ static int parse_ch_cfg(struct mhi_controller
 *mhi_cntrl,
 			const struct mhi_controller_config *config)  {
 	const struct mhi_channel_config *ch_cfg;
Quoted 8 lines

drivers/bus/mhi/core/init.c static int parse_ch_cfg(struct mhi_controller · line 697

Quoted 4 lines
drivers/bus/mhi/core/init.c +1 -1
-	struct device *dev = &mhi_cntrl->mhi_dev->dev;
+	struct device *dev = mhi_cntrl->cntrl_dev;
 	int i;
 	u32 chan;

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

Can you also add a "Fixes:" tag to the patch?

Refer Documentation/process/submitting-patches.rst:

If your patch fixes a bug in a specific commit, e.g. you found an issue using ``git bisect``, please use the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and the one line summary. Do not split the tag across multiple lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify parsing scripts. For example::

	Fixes: 54a4f0239f2e ("KVM: MMU: make kvm_mmu_zap_page() return the 

number of pages it actually freed")

Thanks,
Bhaumik

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project