Message ID | 20240301070910.1287862-1-vamsi-krishna.brahmajosyula@broadcom.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [v5.15-v5.4] fs,hugetlb: fix NULL pointer dereference in hugetlbs_fill_super | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Fri, Mar 01, 2024 at 01:09:10AM -0600, Vamsi Krishna Brahmajosyula wrote: > From: Oscar Salvador <osalvador@suse.de> > > commit 79d72c68c58784a3e1cd2378669d51bfd0cb7498 upstream. Now queued up, thanks. greg k-h
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 54379ee573b1..9b6004bc96de 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1234,6 +1234,7 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par { struct hugetlbfs_fs_context *ctx = fc->fs_private; struct fs_parse_result result; + struct hstate *h; char *rest; unsigned long ps; int opt; @@ -1278,11 +1279,12 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par case Opt_pagesize: ps = memparse(param->string, &rest); - ctx->hstate = size_to_hstate(ps); - if (!ctx->hstate) { + h = size_to_hstate(ps); + if (!h) { pr_err("Unsupported page size %lu MB\n", ps >> 20); return -EINVAL; } + ctx->hstate = h; return 0; case Opt_min_size: