Skip to content

Commit 5e37269

Browse files
committed
Merge tag 'pstore-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore updates from Kees Cook: - Check for out-of-memory condition during initialization (Jiasheng Jiang) - Fix documentation typos (Tudor Ambarus) * tag 'pstore-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: pstore/platform: Add check for kstrdup docs: pstore-blk.rst: fix typo, s/console/ftrace docs: pstore-blk.rst: use "about" as a preposition after "care"
2 parents befaa60 + a19d48f commit 5e37269

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Documentation/admin-guide/pstore-blk.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ kmsg_size
7676
~~~~~~~~~
7777

7878
The chunk size in KB for oops/panic front-end. It **MUST** be a multiple of 4.
79-
It's optional if you do not care oops/panic log.
79+
It's optional if you do not care about the oops/panic log.
8080

8181
There are multiple chunks for oops/panic front-end depending on the remaining
8282
space except other pstore front-ends.
@@ -88,7 +88,7 @@ pmsg_size
8888
~~~~~~~~~
8989

9090
The chunk size in KB for pmsg front-end. It **MUST** be a multiple of 4.
91-
It's optional if you do not care pmsg log.
91+
It's optional if you do not care about the pmsg log.
9292

9393
Unlike oops/panic front-end, there is only one chunk for pmsg front-end.
9494

@@ -100,7 +100,7 @@ console_size
100100
~~~~~~~~~~~~
101101

102102
The chunk size in KB for console front-end. It **MUST** be a multiple of 4.
103-
It's optional if you do not care console log.
103+
It's optional if you do not care about the console log.
104104

105105
Similar to pmsg front-end, there is only one chunk for console front-end.
106106

@@ -111,7 +111,7 @@ ftrace_size
111111
~~~~~~~~~~~
112112

113113
The chunk size in KB for ftrace front-end. It **MUST** be a multiple of 4.
114-
It's optional if you do not care console log.
114+
It's optional if you do not care about the ftrace log.
115115

116116
Similar to oops front-end, there are multiple chunks for ftrace front-end
117117
depending on the count of cpu processors. Each chunk size is equal to

fs/pstore/platform.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ static int pstore_write_user_compat(struct pstore_record *record,
464464
*/
465465
int pstore_register(struct pstore_info *psi)
466466
{
467+
char *new_backend;
468+
467469
if (backend && strcmp(backend, psi->name)) {
468470
pr_warn("backend '%s' already in use: ignoring '%s'\n",
469471
backend, psi->name);
@@ -484,11 +486,16 @@ int pstore_register(struct pstore_info *psi)
484486
return -EINVAL;
485487
}
486488

489+
new_backend = kstrdup(psi->name, GFP_KERNEL);
490+
if (!new_backend)
491+
return -ENOMEM;
492+
487493
mutex_lock(&psinfo_lock);
488494
if (psinfo) {
489495
pr_warn("backend '%s' already loaded: ignoring '%s'\n",
490496
psinfo->name, psi->name);
491497
mutex_unlock(&psinfo_lock);
498+
kfree(new_backend);
492499
return -EBUSY;
493500
}
494501

@@ -521,7 +528,7 @@ int pstore_register(struct pstore_info *psi)
521528
* Update the module parameter backend, so it is visible
522529
* through /sys/module/pstore/parameters/backend
523530
*/
524-
backend = kstrdup(psi->name, GFP_KERNEL);
531+
backend = new_backend;
525532

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

0 commit comments

Comments
 (0)