lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140915.123755.1868053059646672094.davem@davemloft.net>
Date:	Mon, 15 Sep 2014 12:37:55 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	santosh.shilimkar@...com
Cc:	netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, robh+dt@...nel.org,
	grant.likely@...aro.org, devicetree@...r.kernel.org,
	sandeep_n@...com, jhs@...atatu.com
Subject: Re: [PATCH v3 2/3] net: Add Keystone NetCP ethernet driver

From: Santosh Shilimkar <santosh.shilimkar@...com>
Date: Sat, 13 Sep 2014 16:07:18 -0400

> +	/* Find this module in the sub-tree for this device */
> +	devices = of_get_child_by_name(node, "netcp-devices");
> +	if (!devices) {
> +		dev_err(dev, "could not find netcp-devices node\n");
> +		return NETCP_MOD_PROBE_SKIPPED;
> +	}
> +
> +	for_each_available_child_of_node(devices, child) {
> +		const char *name = netcp_node_name(child);
> +
> +		if (!strcasecmp(module->name, name))
> +			break;
> +	}
> +
> +	/* If module not used for this device, skip it */
> +	if (child == NULL) {
> +		dev_warn(dev, "module(%s) not used for device\n", module->name);
> +		return NETCP_MOD_PROBE_SKIPPED;
> +	}

of_get_child_by_name() takes a reference to an OF node, you must release
it in the error path.

> +	inst_modpriv = devm_kzalloc(dev, sizeof(*inst_modpriv), GFP_KERNEL);
> +	if (!inst_modpriv) {
> +		dev_err(dev, "Failed to allocate instance for %s\n",
> +			module->name);
> +		return -ENOMEM;
> +	}

Likewise, but here you have to release both "devices" and "child".

You're going to have to fix this OF node refcount problem for this
entire probe routine.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ