Skip to contentSkip to conversation

ceph: null deref on allocation failure

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ceph: null deref on allocation failure

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

net/ceph/osd_client.c +1 -1
index 02212ed..b6776cb 100644
@@ -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;
#1 lore raw
Quoted 24 lines · Dan Carpenter

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

net/ceph/osd_client.c +1 -2
index 02212ed..b6776cb 100644
@@ -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;
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html