ceph: handle kmalloc() failure
authorDan Carpenter <error27@gmail.com>
Sat, 20 Mar 2010 12:30:16 +0000 (15:30 +0300)
committerSage Weil <sage@newdream.net>
Tue, 23 Mar 2010 14:47:04 +0000 (07:47 -0700)
Return ERR_PTR(-ENOMEM) if kmalloc() fails.  We handle allocation
failures the same way later in the function.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/mds_client.c

index b6b5348055fc395a394bf0b832289d62c63dc02f..ad0fbc3128d3b48c985d8fdd6f0070495c83fe60 100644 (file)
@@ -328,6 +328,8 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,
        struct ceph_mds_session *s;
 
        s = kzalloc(sizeof(*s), GFP_NOFS);
+       if (!s)
+               return ERR_PTR(-ENOMEM);
        s->s_mdsc = mdsc;
        s->s_mds = mds;
        s->s_state = CEPH_MDS_SESSION_NEW;