From: Mariusz Kozlowski Date: Sat, 26 Mar 2011 18:29:34 +0000 (+0100) Subject: ceph: fix possible NULL pointer dereference X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6b0ae4097c1ebad98c7b33f83b4ca7e93890ed12;p=linux-beck.git ceph: fix possible NULL pointer dereference This patch fixes 'event_work' dereference before it is checked for NULL. Signed-off-by: Mariusz Kozlowski Signed-off-by: Sage Weil --- diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 02212ed50852..b6776cb627cc 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;