diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 57085e43320f..238ad158340f 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -474,7 +474,8 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) * @c: UBIFS file-system description object * * This function returns a pointer to the superblock node or a negative error - * code. + * code. Note, the user of this function is responsible of kfree()'ing the + * returned superblock buffer. */ struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c) { diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 333e181ee987..8440ba834d52 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1550,6 +1550,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) } sup->leb_cnt = cpu_to_le32(c->leb_cnt); err = ubifs_write_sb_node(c, sup); + kfree(sup); if (err) goto out; }