Skip to content

Commit 529af90

Browse files
scottmayhewTrond Myklebust
authored andcommitted
NFS: Fix a few constant_table array definitions
nfs_vers_tokens, nfs_xprt_protocol_tokens, and nfs_secflavor_tokens were all missing an empty item at the end of the array, allowing lookup_constant() to potentially walk off the end and trigger and oops. Reported-by: Olga Kornievskaia <[email protected]> Signed-off-by: Scott Mayhew <[email protected]> Fixes: e38bb23 ("NFS: Convert mount option parsing to use functionality from fs_parser.h") Cc: [email protected] # v5.6 Signed-off-by: Trond Myklebust <[email protected]>
1 parent ed5d588 commit 529af90

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/nfs/fs_context.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static const struct constant_table nfs_vers_tokens[] = {
190190
{ "4.0", Opt_vers_4_0 },
191191
{ "4.1", Opt_vers_4_1 },
192192
{ "4.2", Opt_vers_4_2 },
193+
{}
193194
};
194195

195196
enum {
@@ -202,13 +203,14 @@ enum {
202203
nr__Opt_xprt
203204
};
204205

205-
static const struct constant_table nfs_xprt_protocol_tokens[nr__Opt_xprt] = {
206+
static const struct constant_table nfs_xprt_protocol_tokens[] = {
206207
{ "rdma", Opt_xprt_rdma },
207208
{ "rdma6", Opt_xprt_rdma6 },
208209
{ "tcp", Opt_xprt_tcp },
209210
{ "tcp6", Opt_xprt_tcp6 },
210211
{ "udp", Opt_xprt_udp },
211212
{ "udp6", Opt_xprt_udp6 },
213+
{}
212214
};
213215

214216
enum {
@@ -239,6 +241,7 @@ static const struct constant_table nfs_secflavor_tokens[] = {
239241
{ "spkm3i", Opt_sec_spkmi },
240242
{ "spkm3p", Opt_sec_spkmp },
241243
{ "sys", Opt_sec_sys },
244+
{}
242245
};
243246

244247
/*

0 commit comments

Comments
 (0)