All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Handle errors in rmmod
@ 2009-07-22  3:16 Pavel Roskin
  2009-07-22  3:16 ` [PATCH 2/4] Fix insmod not to increase refcount above 1 Pavel Roskin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pavel Roskin @ 2009-07-22  3:16 UTC (permalink / raw)
  To: grub-devel

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;
 }



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-23 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22  3:16 [PATCH 1/4] Handle errors in rmmod Pavel Roskin
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

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.