Re: [syzbot] general protection fault in _parse_integer_fixup_radix

From: Ian Kent
Date: Sun Oct 23 2022 - 20:10:53 EST


On 24/10/22 02:50, Hugh Dickins wrote:
On Sun, 23 Oct 2022, Tetsuo Handa wrote:

syzbot is reporting that "vfs: parse: deal with zero length string value"
in linux-next.git broke tmpfs's mount option parsing, for tmpfs is expecting that
vfs_parse_fs_string() returning 0 implies that param.string != NULL.

The "nr_inodes" parameter for tmpfs is interpreted as "nr_inodes=$integer", but
the addition of

if (!v_size) {
param.string = NULL;
param.type = fs_value_is_empty;
} else {

to vfs_parse_fs_string() and

if (param->type == fs_value_is_empty)
return 0;

to fs_param_is_string() broke expectation by tmpfs.

Parsing an fs string that has zero length should result in the parameter
being set to NULL so that downstream processing handles it correctly.

is wrong and

Parsing an fs string that has zero length should result in invalid argument
error so that downstream processing does not dereference NULL param.string
field.

It's not quite as simple at that.


Not allowing a zero length string will break cases where mount "source"

can be empty.


Maybe parsing of "source" would be better handled separately, rather than

with options handling code, it is slightly different ... mmm ... I'll check

the reported cases ...


Ian