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

Commit 04bbc8e1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pstore update from Tony Luck:
 "Fixes for pstore for 3.11 merge window"

* tag 'please-pull-pstore' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux:
  efivars: If pstore_register fails, free unneeded pstore buffer
  acpi: Eliminate console msg if pstore.backend excludes ERST
  pstore: Return unique error if backend registration excluded by kernel param
  pstore: Fail to unlink if a driver has not defined pstore_erase
  pstore/ram: remove the power of buffer size limitation
  pstore/ram: avoid atomic accesses for ioremapped regions
  efi, pstore: Cocci spatch "memdup.spatch"
parents e39dfe52 0d838347
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -1180,20 +1180,28 @@ static int __init erst_init(void)
	if (!erst_erange.vaddr)
	if (!erst_erange.vaddr)
		goto err_release_erange;
		goto err_release_erange;


	pr_info(ERST_PFX
	"Error Record Serialization Table (ERST) support is initialized.\n");

	buf = kmalloc(erst_erange.size, GFP_KERNEL);
	buf = kmalloc(erst_erange.size, GFP_KERNEL);
	spin_lock_init(&erst_info.buf_lock);
	spin_lock_init(&erst_info.buf_lock);
	if (buf) {
	if (buf) {
		erst_info.buf = buf + sizeof(struct cper_pstore_record);
		erst_info.buf = buf + sizeof(struct cper_pstore_record);
		erst_info.bufsize = erst_erange.size -
		erst_info.bufsize = erst_erange.size -
				    sizeof(struct cper_pstore_record);
				    sizeof(struct cper_pstore_record);
		if (pstore_register(&erst_info)) {
		rc = pstore_register(&erst_info);
			pr_info(ERST_PFX "Could not register with persistent store\n");
		if (rc) {
			if (rc != -EPERM)
				pr_info(ERST_PFX
				"Could not register with persistent store\n");
			erst_info.buf = NULL;
			erst_info.bufsize = 0;
			kfree(buf);
			kfree(buf);
		}
		}
	}
	} else

		pr_err(ERST_PFX
	pr_info(ERST_PFX
		"Failed to allocate %lld bytes for persistent store error log\n",
	"Error Record Serialization Table (ERST) support is initialized.\n");
		erst_erange.size);


	return 0;
	return 0;


+6 −3
Original line number Original line Diff line number Diff line
@@ -79,10 +79,9 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
			   &entry->var.DataSize, entry->var.Data);
			   &entry->var.DataSize, entry->var.Data);
	size = entry->var.DataSize;
	size = entry->var.DataSize;


	*cb_data->buf = kmalloc(size, GFP_KERNEL);
	*cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL);
	if (*cb_data->buf == NULL)
	if (*cb_data->buf == NULL)
		return -ENOMEM;
		return -ENOMEM;
	memcpy(*cb_data->buf, entry->var.Data, size);
	return size;
	return size;
}
}


@@ -236,7 +235,11 @@ static __init int efivars_pstore_init(void)
	efi_pstore_info.bufsize = 1024;
	efi_pstore_info.bufsize = 1024;
	spin_lock_init(&efi_pstore_info.buf_lock);
	spin_lock_init(&efi_pstore_info.buf_lock);


	pstore_register(&efi_pstore_info);
	if (pstore_register(&efi_pstore_info)) {
		kfree(efi_pstore_info.buf);
		efi_pstore_info.buf = NULL;
		efi_pstore_info.bufsize = 0;
	}


	return 0;
	return 0;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,8 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
	if (p->psi->erase)
	if (p->psi->erase)
		p->psi->erase(p->type, p->id, p->count,
		p->psi->erase(p->type, p->id, p->count,
			      dentry->d_inode->i_ctime, p->psi);
			      dentry->d_inode->i_ctime, p->psi);
	else
		return -EPERM;


	return simple_unlink(dir, dentry);
	return simple_unlink(dir, dentry);
}
}
+6 −5
Original line number Original line Diff line number Diff line
@@ -239,17 +239,15 @@ int pstore_register(struct pstore_info *psi)
{
{
	struct module *owner = psi->owner;
	struct module *owner = psi->owner;


	if (backend && strcmp(backend, psi->name))
		return -EPERM;

	spin_lock(&pstore_lock);
	spin_lock(&pstore_lock);
	if (psinfo) {
	if (psinfo) {
		spin_unlock(&pstore_lock);
		spin_unlock(&pstore_lock);
		return -EBUSY;
		return -EBUSY;
	}
	}


	if (backend && strcmp(backend, psi->name)) {
		spin_unlock(&pstore_lock);
		return -EINVAL;
	}

	if (!psi->write)
	if (!psi->write)
		psi->write = pstore_write_compat;
		psi->write = pstore_write_compat;
	psinfo = psi;
	psinfo = psi;
@@ -274,6 +272,9 @@ int pstore_register(struct pstore_info *psi)
		add_timer(&pstore_timer);
		add_timer(&pstore_timer);
	}
	}


	pr_info("pstore: Registered %s as persistent store backend\n",
		psi->name);

	return 0;
	return 0;
}
}
EXPORT_SYMBOL_GPL(pstore_register);
EXPORT_SYMBOL_GPL(pstore_register);
+0 −2
Original line number Original line Diff line number Diff line
@@ -399,8 +399,6 @@ static int ramoops_probe(struct platform_device *pdev)
		goto fail_out;
		goto fail_out;
	}
	}


	if (!is_power_of_2(pdata->mem_size))
		pdata->mem_size = rounddown_pow_of_two(pdata->mem_size);
	if (!is_power_of_2(pdata->record_size))
	if (!is_power_of_2(pdata->record_size))
		pdata->record_size = rounddown_pow_of_two(pdata->record_size);
		pdata->record_size = rounddown_pow_of_two(pdata->record_size);
	if (!is_power_of_2(pdata->console_size))
	if (!is_power_of_2(pdata->console_size))
Loading