Skip to content

Commit a96fd1c

Browse files
committed
Merge tag 'for-linus-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs
Pull ubifs updates from Richard Weinberger: - Kernel-doc fixes - Fixes for memory leaks in authentication option parsing * tag 'for-linus-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: ubifs: mount_ubifs: Release authentication resource in error handling path ubifs: Don't parse authentication mount options in remount process ubifs: Fix a memleak after dumping authentication mount options ubifs: Fix some kernel-doc warnings in tnc.c ubifs: Fix some kernel-doc warnings in replay.c ubifs: Fix some kernel-doc warnings in gc.c ubifs: Fix 'hash' kernel-doc warning in auth.c
2 parents 9d9af10 + e2a05cc commit a96fd1c

5 files changed

Lines changed: 34 additions & 21 deletions

File tree

fs/ubifs/auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash,
5454
* ubifs_prepare_auth_node - Prepare an authentication node
5555
* @c: UBIFS file-system description object
5656
* @node: the node to calculate a hash for
57-
* @hash: input hash of previous nodes
57+
* @inhash: input hash of previous nodes
5858
*
5959
* This function prepares an authentication node for writing onto flash.
6060
* It creates a HMAC from the given input hash and writes it to the node.

fs/ubifs/gc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@
5757
/**
5858
* switch_gc_head - switch the garbage collection journal head.
5959
* @c: UBIFS file-system description object
60-
* @buf: buffer to write
61-
* @len: length of the buffer to write
62-
* @lnum: LEB number written is returned here
63-
* @offs: offset written is returned here
6460
*
6561
* This function switch the GC head to the next LEB which is reserved in
6662
* @c->gc_lnum. Returns %0 in case of success, %-EAGAIN if commit is required,

fs/ubifs/replay.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,6 @@ static int add_replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead,
931931
* validate_ref - validate a reference node.
932932
* @c: UBIFS file-system description object
933933
* @ref: the reference node to validate
934-
* @ref_lnum: LEB number of the reference node
935-
* @ref_offs: reference node offset
936934
*
937935
* This function returns %1 if a bud reference already exists for the LEB. %0 is
938936
* returned if the reference node is new, otherwise %-EINVAL is returned if

fs/ubifs/super.c

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,14 +1110,20 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
11101110
break;
11111111
}
11121112
case Opt_auth_key:
1113-
c->auth_key_name = kstrdup(args[0].from, GFP_KERNEL);
1114-
if (!c->auth_key_name)
1115-
return -ENOMEM;
1113+
if (!is_remount) {
1114+
c->auth_key_name = kstrdup(args[0].from,
1115+
GFP_KERNEL);
1116+
if (!c->auth_key_name)
1117+
return -ENOMEM;
1118+
}
11161119
break;
11171120
case Opt_auth_hash_name:
1118-
c->auth_hash_name = kstrdup(args[0].from, GFP_KERNEL);
1119-
if (!c->auth_hash_name)
1120-
return -ENOMEM;
1121+
if (!is_remount) {
1122+
c->auth_hash_name = kstrdup(args[0].from,
1123+
GFP_KERNEL);
1124+
if (!c->auth_hash_name)
1125+
return -ENOMEM;
1126+
}
11211127
break;
11221128
case Opt_ignore:
11231129
break;
@@ -1141,6 +1147,18 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
11411147
return 0;
11421148
}
11431149

1150+
/*
1151+
* ubifs_release_options - release mount parameters which have been dumped.
1152+
* @c: UBIFS file-system description object
1153+
*/
1154+
static void ubifs_release_options(struct ubifs_info *c)
1155+
{
1156+
kfree(c->auth_key_name);
1157+
c->auth_key_name = NULL;
1158+
kfree(c->auth_hash_name);
1159+
c->auth_hash_name = NULL;
1160+
}
1161+
11441162
/**
11451163
* destroy_journal - destroy journal data structures.
11461164
* @c: UBIFS file-system description object
@@ -1313,7 +1331,7 @@ static int mount_ubifs(struct ubifs_info *c)
13131331

13141332
err = ubifs_read_superblock(c);
13151333
if (err)
1316-
goto out_free;
1334+
goto out_auth;
13171335

13181336
c->probing = 0;
13191337

@@ -1325,18 +1343,18 @@ static int mount_ubifs(struct ubifs_info *c)
13251343
ubifs_err(c, "'compressor \"%s\" is not compiled in",
13261344
ubifs_compr_name(c, c->default_compr));
13271345
err = -ENOTSUPP;
1328-
goto out_free;
1346+
goto out_auth;
13291347
}
13301348

13311349
err = init_constants_sb(c);
13321350
if (err)
1333-
goto out_free;
1351+
goto out_auth;
13341352

13351353
sz = ALIGN(c->max_idx_node_sz, c->min_io_size) * 2;
13361354
c->cbuf = kmalloc(sz, GFP_NOFS);
13371355
if (!c->cbuf) {
13381356
err = -ENOMEM;
1339-
goto out_free;
1357+
goto out_auth;
13401358
}
13411359

13421360
err = alloc_wbufs(c);
@@ -1611,6 +1629,8 @@ static int mount_ubifs(struct ubifs_info *c)
16111629
free_wbufs(c);
16121630
out_cbuf:
16131631
kfree(c->cbuf);
1632+
out_auth:
1633+
ubifs_exit_authentication(c);
16141634
out_free:
16151635
kfree(c->write_reserve_buf);
16161636
kfree(c->bu.buf);
@@ -1650,8 +1670,7 @@ static void ubifs_umount(struct ubifs_info *c)
16501670
ubifs_lpt_free(c, 0);
16511671
ubifs_exit_authentication(c);
16521672

1653-
kfree(c->auth_key_name);
1654-
kfree(c->auth_hash_name);
1673+
ubifs_release_options(c);
16551674
kfree(c->cbuf);
16561675
kfree(c->rcvrd_mst_node);
16571676
kfree(c->mst_node);
@@ -2221,6 +2240,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
22212240
out_unlock:
22222241
mutex_unlock(&c->umount_mutex);
22232242
out_close:
2243+
ubifs_release_options(c);
22242244
ubi_close_volume(c->ubi);
22252245
out:
22262246
return err;

fs/ubifs/tnc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr,
360360
/**
361361
* lnc_free - remove a leaf node from the leaf node cache.
362362
* @zbr: zbranch of leaf node
363-
* @node: leaf node
364363
*/
365364
static void lnc_free(struct ubifs_zbranch *zbr)
366365
{
@@ -3466,7 +3465,7 @@ int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level,
34663465
/**
34673466
* dbg_check_inode_size - check if inode size is correct.
34683467
* @c: UBIFS file-system description object
3469-
* @inum: inode number
3468+
* @inode: inode to check
34703469
* @size: inode size
34713470
*
34723471
* This function makes sure that the inode size (@size) is correct and it does

0 commit comments

Comments
 (0)