Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1373510 > unrolled thread
| Started by | Jiri Kosina <jikos@kernel.org> |
|---|---|
| First post | 2016-04-07 18:10 +0200 |
| Last post | 2016-04-07 22:40 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH] livepatch: robustify klp_register_patch() API error checking Jiri Kosina <jikos@kernel.org> - 2016-04-07 18:10 +0200
Re: [PATCH] livepatch: robustify klp_register_patch() API error checking Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-07 20:10 +0200
Re: livepatch: robustify klp_register_patch() API error checking Jessica Yu <jeyu@redhat.com> - 2016-04-07 20:30 +0200
Re: [PATCH] livepatch: robustify klp_register_patch() API error checking Jiri Kosina <jikos@kernel.org> - 2016-04-07 22:40 +0200
| From | Jiri Kosina <jikos@kernel.org> |
|---|---|
| Date | 2016-04-07 18:10 +0200 |
| Subject | [PATCH] livepatch: robustify klp_register_patch() API error checking |
| Message-ID | <rlkFl-6uI-29@gated-at.bofh.it> |
From: Jiri Kosina <jkosina@suse.cz>
Commit 425595a7fc20 ("livepatch: reuse module loader code to write
relocations") adds a possibility of dereferncing pointers supplied by the
consumer of the livepatch API before sanity (NULL) checking them (patch
and patch->mod).
Spotted by smatch tool.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
kernel/livepatch/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index eb5db6e..28c37fa 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -876,6 +876,9 @@ int klp_register_patch(struct klp_patch *patch)
{
int ret;
+ if (!patch || !patch->mod)
+ return -EINVAL;
+
if (!is_livepatch_module(patch->mod)) {
pr_err("module %s is not marked as a livepatch module",
patch->mod->name);
@@ -885,9 +888,6 @@ int klp_register_patch(struct klp_patch *patch)
if (!klp_initialized())
return -ENODEV;
- if (!patch || !patch->mod)
- return -EINVAL;
-
/*
* A reference is taken on the patch module to prevent it from being
* unloaded. Right now, we don't allow patch modules to unload since
--
Jiri Kosina
SUSE Labs
[toc] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2016-04-07 20:10 +0200 |
| Message-ID | <rlmxs-7V5-31@gated-at.bofh.it> |
| In reply to | #1373510 |
On Thu, Apr 07, 2016 at 06:06:25PM +0200, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
>
> Commit 425595a7fc20 ("livepatch: reuse module loader code to write
> relocations") adds a possibility of dereferncing pointers supplied by the
> consumer of the livepatch API before sanity (NULL) checking them (patch
> and patch->mod).
>
> Spotted by smatch tool.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
--
Josh
[toc] | [prev] | [next] | [standalone]
| From | Jessica Yu <jeyu@redhat.com> |
|---|---|
| Date | 2016-04-07 20:30 +0200 |
| Subject | Re: livepatch: robustify klp_register_patch() API error checking |
| Message-ID | <rlmQN-82W-9@gated-at.bofh.it> |
| In reply to | #1373510 |
+++ Jiri Kosina [07/04/16 18:06 +0200]:
>From: Jiri Kosina <jkosina@suse.cz>
>
>Commit 425595a7fc20 ("livepatch: reuse module loader code to write
>relocations") adds a possibility of dereferncing pointers supplied by the
>consumer of the livepatch API before sanity (NULL) checking them (patch
>and patch->mod).
>
>Spotted by smatch tool.
>
>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Jessica Yu <jeyu@redhat.com>
Thank you Jiri!
[toc] | [prev] | [next] | [standalone]
| From | Jiri Kosina <jikos@kernel.org> |
|---|---|
| Date | 2016-04-07 22:40 +0200 |
| Message-ID | <rloSC-YH-23@gated-at.bofh.it> |
| In reply to | #1373510 |
On Thu, 7 Apr 2016, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
>
> Commit 425595a7fc20 ("livepatch: reuse module loader code to write
> relocations") adds a possibility of dereferncing pointers supplied by the
> consumer of the livepatch API before sanity (NULL) checking them (patch
> and patch->mod).
>
> Spotted by smatch tool.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Jessica Yu <jeyu@redhat.com>
Pushed out. Thanks,
--
Jiri Kosina
SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web