Merge tag 'v5.7-rc7' into perf/core, to pick up fixes
[linux-2.6-microblaze.git] / fs / overlayfs / export.c
index 475c61f..ed5c107 100644 (file)
@@ -783,6 +783,9 @@ static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type)
        if (fh_type != OVL_FILEID_V0)
                return ERR_PTR(-EINVAL);
 
+       if (buflen <= OVL_FH_WIRE_OFFSET)
+               return ERR_PTR(-EINVAL);
+
        fh = kzalloc(buflen, GFP_KERNEL);
        if (!fh)
                return ERR_PTR(-ENOMEM);