diff mbox series

[AUTOSEL,for-4.4,01/39] extcon: palmas: Check the parent instance to prevent the NULL

Message ID 20171108205027.27525-1-alexander.levin@verizon.com
State Superseded
Headers show
Series [AUTOSEL,for-4.4,01/39] extcon: palmas: Check the parent instance to prevent the NULL | expand

Commit Message

Levin, Alexander (Sasha Levin) Nov. 8, 2017, 8:50 p.m. UTC
From: Roger Quadros <rogerq@ti.com>


[ Upstream commit 9fe172b9be532acc23e35ba693700383ab775e66 ]

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros <rogerq@ti.com>

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

---
 drivers/extcon/extcon-palmas.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.11.0

Comments

Matt Redfearn Nov. 9, 2017, 9:16 a.m. UTC | #1
On 08/11/17 20:50, Levin, Alexander (Sasha Levin) wrote:
> From: Matt Redfearn <matt.redfearn@imgtec.com>

>

> [ Upstream commit 44079d3509aee89c58f3e4fd929fa53ab2299019 ]

>

> When relocatable support for MIPS was merged, there was no support for

> an architecture to add a postlink step for vmlinux. This meant that only

> invoking a target within the boot directory, such as uImage, caused the

> relocations to be inserted into vmlinux. Building just the vmlinux

> target would result in a relocatable kernel with no relocation

> information present.

>

> Commit fbe6e37dab97 ("kbuild: add arch specific post-link Makefile")


Hi,

This patch depends on upstream commit fbe6e37dab97 ("kbuild: add arch 
specific post-link Makefile") which was introduced in v4.9.

This patch is an improvement to the build flow and I would not consider 
it for backporting - certainly not to v4.8 or earlier which is missing 
the dependency. Applying it will not break anything, however, it will 
perform no function either without the supporting dependency.

Thanks,
Matt


> recified this situation, so MIPS can now define a postlink step to add

> relocation information into vmlinux, and remove the additional steps

> tacked onto boot targets.

>

> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>

> Tested-by: Steven J. Hill <steven.hill@cavium.com>

> Cc: linux-mips@linux-mips.org

> Cc: linux-kernel@vger.kernel.org

> Patchwork: https://patchwork.linux-mips.org/patch/14554/

> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>

> ---

>   arch/mips/Makefile.postlink | 35 +++++++++++++++++++++++++++++++++++

>   1 file changed, 35 insertions(+)

>   create mode 100644 arch/mips/Makefile.postlink

>

> diff --git a/arch/mips/Makefile.postlink b/arch/mips/Makefile.postlink

> new file mode 100644

> index 000000000000..b0ddf0701a31

> --- /dev/null

> +++ b/arch/mips/Makefile.postlink

> @@ -0,0 +1,35 @@

> +# ===========================================================================

> +# Post-link MIPS pass

> +# ===========================================================================

> +#

> +# 1. Insert relocations into vmlinux

> +

> +PHONY := __archpost

> +__archpost:

> +

> +include include/config/auto.conf

> +include scripts/Kbuild.include

> +

> +CMD_RELOCS = arch/mips/boot/tools/relocs

> +quiet_cmd_relocs = RELOCS $@

> +      cmd_relocs = $(CMD_RELOCS) $@

> +

> +# `@true` prevents complaint when there is nothing to be done

> +

> +vmlinux: FORCE

> +	@true

> +ifeq ($(CONFIG_RELOCATABLE),y)

> +	$(call if_changed,relocs)

> +endif

> +

> +%.ko: FORCE

> +	@true

> +

> +clean:

> +	@true

> +

> +PHONY += FORCE clean

> +

> +FORCE:

> +

> +.PHONY: $(PHONY)
Levin, Alexander (Sasha Levin) Nov. 9, 2017, 4:42 p.m. UTC | #2
On Thu, Nov 09, 2017 at 09:16:44AM +0000, Matt Redfearn wrote:
>

>

>On 08/11/17 20:50, Levin, Alexander (Sasha Levin) wrote:

>>From: Matt Redfearn <matt.redfearn@imgtec.com>

>>

>>[ Upstream commit 44079d3509aee89c58f3e4fd929fa53ab2299019 ]

>>

>>When relocatable support for MIPS was merged, there was no support for

>>an architecture to add a postlink step for vmlinux. This meant that only

>>invoking a target within the boot directory, such as uImage, caused the

>>relocations to be inserted into vmlinux. Building just the vmlinux

>>target would result in a relocatable kernel with no relocation

>>information present.

>>

>>Commit fbe6e37dab97 ("kbuild: add arch specific post-link Makefile")

>

>Hi,

>

>This patch depends on upstream commit fbe6e37dab97 ("kbuild: add arch 

>specific post-link Makefile") which was introduced in v4.9.

>

>This patch is an improvement to the build flow and I would not 

>consider it for backporting - certainly not to v4.8 or earlier which 

>is missing the dependency. Applying it will not break anything, 

>however, it will perform no function either without the supporting 

>dependency.


I'll just drop it from 4.9 and 4.4 then, Thanks Matt.

-- 

Thanks,
Sasha
diff mbox series

Patch

diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 93c30a885740..aa2f6bb82b32 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -190,6 +190,11 @@  static int palmas_usb_probe(struct platform_device *pdev)
 	struct palmas_usb *palmas_usb;
 	int status;
 
+	if (!palmas) {
+		dev_err(&pdev->dev, "failed to get valid parent\n");
+		return -EINVAL;
+	}
+
 	palmas_usb = devm_kzalloc(&pdev->dev, sizeof(*palmas_usb), GFP_KERNEL);
 	if (!palmas_usb)
 		return -ENOMEM;