Skip to content

Commit 85f7845

Browse files
committed
Merge tag '9p-for-4.21' of git://github.com/martinetd/linux
Pull 9p updates from Dominique Martinet: "Missing prototype warning fix and a syzkaller fix when a 9p server advertises a too small msize" * tag '9p-for-4.21' of git://github.com/martinetd/linux: 9p/net: put a lower bound on msize net/9p: include trans_common.h to fix missing prototype warning.
2 parents cacf02d + 574d356 commit 85f7845

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎net/9p/client.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ static int parse_opts(char *opts, struct p9_client *clnt)
181181
ret = r;
182182
continue;
183183
}
184+
if (option < 4096) {
185+
p9_debug(P9_DEBUG_ERROR,
186+
"msize should be at least 4k\n");
187+
ret = -EINVAL;
188+
continue;
189+
}
184190
clnt->msize = option;
185191
break;
186192
case Opt_trans:
@@ -983,10 +989,18 @@ static int p9_client_version(struct p9_client *c)
983989
else if (!strncmp(version, "9P2000", 6))
984990
c->proto_version = p9_proto_legacy;
985991
else {
992+
p9_debug(P9_DEBUG_ERROR,
993+
"server returned an unknown version: %s\n", version);
986994
err = -EREMOTEIO;
987995
goto error;
988996
}
989997

998+
if (msize < 4096) {
999+
p9_debug(P9_DEBUG_ERROR,
1000+
"server returned a msize < 4096: %d\n", msize);
1001+
err = -EREMOTEIO;
1002+
goto error;
1003+
}
9901004
if (msize < c->msize)
9911005
c->msize = msize;
9921006

@@ -1043,6 +1057,13 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
10431057
if (clnt->msize > clnt->trans_mod->maxsize)
10441058
clnt->msize = clnt->trans_mod->maxsize;
10451059

1060+
if (clnt->msize < 4096) {
1061+
p9_debug(P9_DEBUG_ERROR,
1062+
"Please specify a msize of at least 4k\n");
1063+
err = -EINVAL;
1064+
goto free_client;
1065+
}
1066+
10461067
err = p9_client_version(clnt);
10471068
if (err)
10481069
goto close_trans;

‎net/9p/trans_common.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include <linux/mm.h>
1616
#include <linux/module.h>
17+
#include "trans_common.h"
1718

1819
/**
1920
* p9_release_pages - Release pages after the transaction.

0 commit comments

Comments
 (0)