Displaying 6 results from an estimated 6 matches for "match_strdup".
2011 Sep 13
5
[PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()
...pts, *orig, *p;
+ char *device_name, *opts, *orig, *p;
int error = 0;
int intarg;
@@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char
*options, fmode_t flags,
}
break;
case Opt_device:
- error = btrfs_scan_one_device(match_strdup(&args[0]),
+ device_name = match_strdup(&args[0]);
+ if (!device_name) {
+ error = -ENOMEM;
+ goto out_free_opts;
+ }
+ error = btrfs_scan_one_device(device_name,
flags, holder, fs_devices);
+...
2008 Jun 10
1
[PATCH, RFC] btrfs: allow scanning multiple devices during mount
...ic int btrfs_parse_early_options(const char *options, int flags,
+ void *holder, char **subvol_name,
+ struct btrfs_fs_devices **fs_devices)
{
substring_t args[MAX_OPT_ARGS];
char *opts, *p;
@@ -240,11 +243,18 @@ static int btrfs_parse_early_options(con
case Opt_subvol:
*subvol_name = match_strdup(&args[0]);
break;
+ case Opt_device:
+ error = btrfs_scan_one_device(match_strdup(&args[0]),
+ flags, holder, fs_devices);
+ if (error)
+ goto out_free_opts;
+ break;
default:
break;
}
}
+ out_free_opts:
kfree(opts);
out:
/*
@@ -380,7 +390,8 @@ static i...
2011 Apr 06
3
[PATCH V2] Btrfs: fix subvolume mount by name problem when default mount subvolume is set
...rg = 0;
+ error = match_int(&args[0], &intarg);
+ if (!error) {
+ /* we want the original fs_tree */
+ if (!intarg)
+ *subvol_rootid =
+ BTRFS_FS_TREE_OBJECTID;
+ else
+ *subvol_rootid = intarg;
+ }
+ break;
case Opt_device:
error = btrfs_scan_one_device(match_strdup(&args[0]),
flags, holder, fs_devices);
@@ -715,6 +729,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
fmode_t mode = FMODE_READ;
char *subvol_name = NULL;
u64 subvol_objectid = 0;
+ u64 subvol_rootid = 0;
int error = 0;
if (!(flags & MS_RDONLY))
@...
2009 Dec 14
0
[PATCH] Btrfs: make subvol=0 mount the original default root
...rg;
+ error = match_int(&args[0], &intarg);
+ if (!error) {
+ /* we want the original fs_tree */
+ if (!intarg)
+ *subvol_objectid =
+ BTRFS_FS_TREE_OBJECTID;
+ else
+ *subvol_objectid = intarg;
+ }
break;
case Opt_device:
error = btrfs_scan_one_device(match_strdup(&args[0]),
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
2013 Jul 24
0
[PATCH RESEND 2/3] Btrfs: use u64 for subvolid when parsing mount options
...intarg;
if (!options)
return 0;
@@ -704,16 +704,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
}
break;
case Opt_subvolid:
- error = match_int(&args[0], &intarg);
- if (!error) {
- goto out;
- } else if (intarg >= 0) {
+ num = match_strdup(&args[0]);
+ if (num) {
+ *subvol_objectid = memparse(num, NULL);
+ kfree(num);
/* we want the original fs_tree */
- if (!intarg)
+ if (!*subvol_objectid)
*subvol_objectid =
BTRFS_FS_TREE_OBJECTID;
- else
- *subvol_objectid = intarg;
} else {
erro...
2011 Nov 09
6
[PATCH 0/5] Btrfs: mount error handling fixes
A bunch of fixes (memory leaks, NULL pointer dereferences and devices
hanging in busy state) to sanitize error handling during mount sequence.
This is on top of for-linus + slyfox''s double-free fix.
Thanks,
Ilya
Ilya Dryomov (5):
Btrfs: fix memory leak in btrfs_parse_early_options()
Btrfs: fix subvol_name leak on error in btrfs_mount()
Btrfs: avoid null dereference and leaks