Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab6a713e authored by Geert Uytterhoeven's avatar Geert Uytterhoeven
Browse files

base: soc: Check for NULL SoC device attributes



If soc_device_match() is used to check the value of a specific
attribute that is not present for the current SoC, the kernel crashes
with a NULL pointer dereference.

Fix this by explicitly checking for the absence of a needed property,
and considering this a non-match.

Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c97db7cc
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -176,19 +176,23 @@ static int soc_device_match_one(struct device *dev, void *arg)
	const struct soc_device_attribute *match = arg;
	const struct soc_device_attribute *match = arg;


	if (match->machine &&
	if (match->machine &&
	    !glob_match(match->machine, soc_dev->attr->machine))
	    (!soc_dev->attr->machine ||
	     !glob_match(match->machine, soc_dev->attr->machine)))
		return 0;
		return 0;


	if (match->family &&
	if (match->family &&
	    !glob_match(match->family, soc_dev->attr->family))
	    (!soc_dev->attr->family ||
	     !glob_match(match->family, soc_dev->attr->family)))
		return 0;
		return 0;


	if (match->revision &&
	if (match->revision &&
	    !glob_match(match->revision, soc_dev->attr->revision))
	    (!soc_dev->attr->revision ||
	     !glob_match(match->revision, soc_dev->attr->revision)))
		return 0;
		return 0;


	if (match->soc_id &&
	if (match->soc_id &&
	    !glob_match(match->soc_id, soc_dev->attr->soc_id))
	    (!soc_dev->attr->soc_id ||
	     !glob_match(match->soc_id, soc_dev->attr->soc_id)))
		return 0;
		return 0;


	return 1;
	return 1;