public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] ceph: null deref on allocation failure
@ 2011-03-29  3:25 Dan Carpenter
  2011-03-29  9:31 ` Yehuda Sadeh Weinraub
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-03-29  3:25 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel, kernel-janitors

The original code checked "event_work" for allocation failures, but only
after it had already use it.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 02212ed..b6776cb 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1602,11 +1602,11 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg)
 	     cookie, ver, event);
 	if (event) {
 		event_work = kmalloc(sizeof(*event_work), GFP_NOIO);
-		INIT_WORK(&event_work->work, do_event_work);
 		if (!event_work) {
 			dout("ERROR: could not allocate event_work\n");
 			goto done_err;
 		}
+		INIT_WORK(&event_work->work, do_event_work);
 		event_work->event = event;
 		event_work->ver = ver;
 		event_work->notify_id = notify_id;

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

* Re: [patch 1/2] ceph: null deref on allocation failure
  2011-03-29  3:25 [patch 1/2] ceph: null deref on allocation failure Dan Carpenter
@ 2011-03-29  9:31 ` Yehuda Sadeh Weinraub
  0 siblings, 0 replies; 2+ messages in thread
From: Yehuda Sadeh Weinraub @ 2011-03-29  9:31 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Sage Weil, ceph-devel, kernel-janitors

On Mon, Mar 28, 2011 at 8:25 PM, Dan Carpenter <error27@gmail.com> wrote:
>
> The original code checked "event_work" for allocation failures, but only
> after it had already use it.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 02212ed..b6776cb 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -1602,11 +1602,11 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg)
>             cookie, ver, event);
>        if (event) {
>                event_work = kmalloc(sizeof(*event_work), GFP_NOIO);
> -               INIT_WORK(&event_work->work, do_event_work);
>                if (!event_work) {
>                        dout("ERROR: could not allocate event_work\n");
>                        goto done_err;
>                }
> +               INIT_WORK(&event_work->work, do_event_work);
>                event_work->event = event;
>                event_work->ver = ver;
>                event_work->notify_id = notify_id;
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks.

This is already fixed in the latest master branch and will be sent to
Linus soon.

Yehuda
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-03-29  9:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-29  3:25 [patch 1/2] ceph: null deref on allocation failure Dan Carpenter
2011-03-29  9:31 ` Yehuda Sadeh Weinraub

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox