bus: mhi: core: Fix null pointer access when parsing MHI configuration
Subsystems (2)
PATCH v2 1/1 bus: mhi: core: Fix null pointer access when parsing MHI configuration
From: "carl.yin" <[email protected]>
Functions parse_ev_cfg() and parse_ch_cfg() access mhi_cntrl->mhi_dev before it is set in function mhi_register_controller(), use cntrl_dev instead of mhi_dev.
--- drivers/bus/mhi/core/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/mhi/core/init.c +2 -2
@@ -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;
@@ -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;
Signature · 1 line
2.25.1
Quoted 9 lines · On 11/2/20 4:27 AM, [email protected] wrote:
From: "carl.yin" <[email protected]>
Functions
parse_ev_cfg()andparse_ch_cfg()accessmhi_cntrl->mhi_devbefore it is set in functionmhi_register_controller(), usecntrl_devinstead ofmhi_dev.Fixes 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers")Signed-off-by carl.yin <[email protected]>Reviewed-by Bhaumik Bhatt <[email protected]>
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 9 lines · On Mon, Nov 02, 2020 at 08:27:10PM +0800, [email protected] wrote:
From: "carl.yin" <[email protected]>
Functions
parse_ev_cfg()andparse_ch_cfg()accessmhi_cntrl->mhi_devbefore it is set in functionmhi_register_controller(), usecntrl_devinstead ofmhi_dev.Fixes 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers")Signed-off-by carl.yin <[email protected]>Reviewed-by Bhaumik Bhatt <[email protected]>
Nit: Your name in the Signed-off-by tag should be in a proper format like "Carl Yin". I'll fix it up while applying. But please fix it in future patches.
Thanks,
Mani
Quoted 29 lines
--- drivers/bus/mhi/core/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/bus/mhi/core/init.c +2
-2@@ -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;@@ -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;Signature · 1 line
2.25.1
Manivannan Sadhasivam
AppliedQuoted 9 lines · On Mon, Nov 02, 2020 at 08:27:10PM +0800, [email protected] wrote:
From: "carl.yin" <[email protected]>
Functions
parse_ev_cfg()andparse_ch_cfg()accessmhi_cntrl->mhi_devbefore it is set in functionmhi_register_controller(), usecntrl_devinstead ofmhi_dev.Fixes 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers")Signed-off-by carl.yin <[email protected]>Reviewed-by Bhaumik Bhatt <[email protected]>
Applied to mhi-next!
Thanks,
Mani
Quoted 29 lines
--- drivers/bus/mhi/core/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/bus/mhi/core/init.c +2
-2@@ -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;@@ -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;Signature · 1 line
2.25.1
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 11 lines · On Mon, 2 Nov 2020 20:27:10 +0800 you wrote:
From: "carl.yin" <[email protected]>
Functions
parse_ev_cfg()andparse_ch_cfg()accessmhi_cntrl->mhi_devbefore it is set in functionmhi_register_controller(), usecntrl_devinstead ofmhi_dev.Fixes 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers")Signed-off-by carl.yin <[email protected]>Reviewed-by Bhaumik Bhatt <[email protected]>[...]
Here is the summary with links:
- [v2] bus: mhi: core: Fix null pointer access when parsing MHI configuration
https://git.kernel.org/qcom/c/f4d0b39c8425
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html