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

Commit 21c5e50e authored by Daniel J Blueman's avatar Daniel J Blueman Committed by H. Peter Anvin
Browse files

x86, amd, mce: Avoid NULL pointer reference on CPU northbridge lookup



When booting on a federated multi-server system (NumaScale), the
processor Northbridge lookup returns NULL; add guards to prevent this
causing an oops.

On those systems, the northbridge is accessed through MMIO and the
"normal" northbridge enumeration in amd_nb.c doesn't work since we're
generating the northbridge ID from the initial APIC ID and the last
is not unique on those systems. Long story short, we end up without
northbridge descriptors.

Signed-off-by: default avatarDaniel J Blueman <daniel@numascale-asia.com>
Cc: stable@vger.kernel.org # 3.6
Link: http://lkml.kernel.org/r/1349073725-14093-1-git-send-email-daniel@numascale-asia.com


[ Boris: beef up commit message ]
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 1bbbbe77
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -576,12 +576,10 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
	int err = 0;
	int err = 0;


	if (shared_bank[bank]) {
	if (shared_bank[bank]) {

		nb = node_to_amd_nb(amd_get_nb_id(cpu));
		nb = node_to_amd_nb(amd_get_nb_id(cpu));
		WARN_ON(!nb);


		/* threshold descriptor already initialized on this node? */
		/* threshold descriptor already initialized on this node? */
		if (nb->bank4) {
		if (nb && nb->bank4) {
			/* yes, use it */
			/* yes, use it */
			b = nb->bank4;
			b = nb->bank4;
			err = kobject_add(b->kobj, &dev->kobj, name);
			err = kobject_add(b->kobj, &dev->kobj, name);
@@ -615,9 +613,11 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
		atomic_set(&b->cpus, 1);
		atomic_set(&b->cpus, 1);


		/* nb is already initialized, see above */
		/* nb is already initialized, see above */
		if (nb) {
			WARN_ON(nb->bank4);
			WARN_ON(nb->bank4);
			nb->bank4 = b;
			nb->bank4 = b;
		}
		}
	}


	err = allocate_threshold_blocks(cpu, bank, 0,
	err = allocate_threshold_blocks(cpu, bank, 0,
					MSR_IA32_MC0_MISC + bank * 4);
					MSR_IA32_MC0_MISC + bank * 4);