usb/gadget/f_fs: fix invalid ffs to cause ramdump

QC patch("usb: gadget: f_fs: Fix NULL pointer issues in ffs driver")
fix multiple mounted issue, it will return "ERR_PTR(-EBUSY)" in
ffs_data_new(), but ffs driver only check ffs if is a NULL point,
the next code using ffs still cause ramdump.

origin-CR: (CR)
Change-Id: Ib2d21b2854163883f07475ef97e1e09a1742c617
Reviewed-on: https://gerrit.mot.com/1313122
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Yuecai Liu <liuyc20@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1338906
Reviewed-on: https://gerrit.mot.com/1449057
Reviewed-on: https://gerrit.mot.com/1751135
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-on: https://gerrit.mot.com/1785338
This commit is contained in:
jixj 2019-02-22 15:54:44 +08:00 • committed by Xiaojun Ji
commit 670e79efe6

View file

@ -1768,6 +1768,7 @@ static int ffs_fs_get_tree(struct fs_context *fc)
return invalf(fc, "No source specified");
ffs = ffs_data_new(fc->source);
if (IS_ERR_OR_NULL(ffs)) {
if (!ffs)
return -ENOMEM;
@ -1775,6 +1776,9 @@ static int ffs_fs_get_tree(struct fs_context *fc)
return PTR_ERR(ffs);
}
if (IS_ERR(ffs))
return PTR_ERR(ffs);
ffs->file_perms = ctx->perms;
ffs->no_disconnect = ctx->no_disconnect;