Skip to content

Commit fea371e

Browse files
committed
Merge tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs
Pull UBI and UBIFS fixes from Richard Weinberger: - Correctly set next cursor for detailed_erase_block_info debugfs file - Don't use crypto_shash_descsize() for digest size in UBIFS - Remove broken lazytime support from UBIFS * tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs: ubi: Fix seq_file usage in detailed_erase_block_info debugfs file ubifs: fix wrong use of crypto_shash_descsize() ubifs: remove broken lazytime support
2 parents d303402 + 0e7572c commit fea371e

File tree

4 files changed

+9
-39
lines changed

4 files changed

+9
-39
lines changed

drivers/mtd/ubi/debug.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
393393
{
394394
struct ubi_device *ubi = s->private;
395395

396-
if (*pos == 0)
397-
return SEQ_START_TOKEN;
398-
399396
if (*pos < ubi->peb_count)
400397
return pos;
401398

@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
409406
{
410407
struct ubi_device *ubi = s->private;
411408

412-
if (v == SEQ_START_TOKEN)
413-
return pos;
414409
(*pos)++;
415410

416411
if (*pos < ubi->peb_count)
@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
432427
int err;
433428

434429
/* If this is the start, print a header */
435-
if (iter == SEQ_START_TOKEN) {
436-
seq_puts(s,
437-
"physical_block_number\terase_count\tblock_status\tread_status\n");
438-
return 0;
439-
}
430+
if (*block_number == 0)
431+
seq_puts(s, "physical_block_number\terase_count\n");
440432

441433
err = ubi_io_is_bad(ubi, *block_number);
442434
if (err)

fs/ubifs/auth.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
7979
struct shash_desc *inhash)
8080
{
8181
struct ubifs_auth_node *auth = node;
82-
u8 *hash;
82+
u8 hash[UBIFS_HASH_ARR_SZ];
8383
int err;
8484

85-
hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
86-
if (!hash)
87-
return -ENOMEM;
88-
8985
{
9086
SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
9187

@@ -94,21 +90,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
9490

9591
err = crypto_shash_final(hash_desc, hash);
9692
if (err)
97-
goto out;
93+
return err;
9894
}
9995

10096
err = ubifs_hash_calc_hmac(c, hash, auth->hmac);
10197
if (err)
102-
goto out;
98+
return err;
10399

104100
auth->ch.node_type = UBIFS_AUTH_NODE;
105101
ubifs_prepare_node(c, auth, ubifs_auth_node_sz(c), 0);
106-
107-
err = 0;
108-
out:
109-
kfree(hash);
110-
111-
return err;
102+
return 0;
112103
}
113104

114105
static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,

fs/ubifs/file.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
13751375
struct ubifs_info *c = inode->i_sb->s_fs_info;
13761376
struct ubifs_budget_req req = { .dirtied_ino = 1,
13771377
.dirtied_ino_d = ALIGN(ui->data_len, 8) };
1378-
int iflags = I_DIRTY_TIME;
13791378
int err, release;
13801379

13811380
if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
@@ -1393,11 +1392,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
13931392
if (flags & S_MTIME)
13941393
inode->i_mtime = *time;
13951394

1396-
if (!(inode->i_sb->s_flags & SB_LAZYTIME))
1397-
iflags |= I_DIRTY_SYNC;
1398-
13991395
release = ui->dirty;
1400-
__mark_inode_dirty(inode, iflags);
1396+
__mark_inode_dirty(inode, I_DIRTY_SYNC);
14011397
mutex_unlock(&ui->ui_mutex);
14021398
if (release)
14031399
ubifs_release_budget(c, &req);

fs/ubifs/replay.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
601601
struct ubifs_scan_node *snod;
602602
int n_nodes = 0;
603603
int err;
604-
u8 *hash, *hmac;
604+
u8 hash[UBIFS_HASH_ARR_SZ];
605+
u8 hmac[UBIFS_HMAC_ARR_SZ];
605606

606607
if (!ubifs_authenticated(c))
607608
return sleb->nodes_cnt;
608609

609-
hash = kmalloc(crypto_shash_descsize(c->hash_tfm), GFP_NOFS);
610-
hmac = kmalloc(c->hmac_desc_len, GFP_NOFS);
611-
if (!hash || !hmac) {
612-
err = -ENOMEM;
613-
goto out;
614-
}
615-
616610
list_for_each_entry(snod, &sleb->nodes, list) {
617611

618612
n_nodes++;
@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
662656
err = 0;
663657
}
664658
out:
665-
kfree(hash);
666-
kfree(hmac);
667-
668659
return err ? err : n_nodes - n_not_auth;
669660
}
670661

0 commit comments

Comments
 (0)