From: Pavel Roskin <proski@gnu.org>
To: grub-devel@gnu.org
Subject: [PATCH 1/4] Handle errors in rmmod
Date: Tue, 21 Jul 2009 23:16:38 -0400 [thread overview]
Message-ID: <20090722031638.6348.79007.stgit@mj.roinet.com> (raw)
ChangeLog:
* commands/minicmd.c (grub_mini_cmd_rmmod): Check the result of
grub_dl_unload(), but not of grub_dl_unref(). On failure,
restore reference count and report error.
---
commands/minicmd.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/commands/minicmd.c b/commands/minicmd.c
index b314388..1f5abae 100644
--- a/commands/minicmd.c
+++ b/commands/minicmd.c
@@ -288,8 +288,12 @@ grub_mini_cmd_rmmod (struct grub_command *cmd __attribute__ ((unused)),
if (! mod)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such module");
- if (grub_dl_unref (mod) <= 0)
- grub_dl_unload (mod);
+ grub_dl_unref (mod);
+ if (grub_dl_unload (mod) == 0)
+ {
+ grub_dl_ref (mod);
+ return grub_error (GRUB_ERR_BAD_MODULE, "`%s' is in use", mod->name);
+ }
return 0;
}
next reply other threads:[~2009-07-22 3:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-22 3:16 Pavel Roskin [this message]
2009-07-22 3:16 ` [PATCH 2/4] Fix insmod not to increase refcount above 1 Pavel Roskin
2009-07-22 3:16 ` [PATCH 3/4] Change grub_file_seek() to return grub_err_t Pavel Roskin
2009-07-23 8:23 ` Vladimir 'phcoder' Serbinenko
2009-07-23 19:14 ` Pavel Roskin
2009-07-22 3:16 ` [PATCH 4/4] Fix ALIGN_UP cutting upper bits Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090722031638.6348.79007.stgit@mj.roinet.com \
--to=proski@gnu.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.