Re: [PATCH[ fix duplicate console-efi entries in pstore
From: Kees Cook
Date: Tue Oct 14 2014 - 11:41:08 EST
On Sun, Oct 12, 2014 at 8:09 PM, Valdis Kletnieks
<Valdis.Kletnieks@xxxxxx> wrote:
> The pstore filesystem still creates duplicate filename/inode pairs for
> some pstore types. Add the id to the filename to prevent that.
Looks good to me, thanks!
Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
-Kees
>
> Before patch:
>
> [/sys/fs/pstore] ls -li
> total 0
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
> 1250 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi
>
>
> After:
>
> [/sys/fs/pstore] ls -li
> total 0
> 1232 -r--r--r--. 1 root root 148 Sep 29 17:09 console-efi-141202499100000
> 1231 -r--r--r--. 1 root root 67 Sep 29 17:09 console-efi-141202499200000
> 1230 -r--r--r--. 1 root root 148 Sep 29 17:44 console-efi-141202705400000
> 1229 -r--r--r--. 1 root root 67 Sep 29 17:44 console-efi-141202705500000
> 1228 -r--r--r--. 1 root root 67 Sep 29 20:42 console-efi-141203772600000
> 1227 -r--r--r--. 1 root root 148 Sep 29 23:42 console-efi-141204854900000
> 1226 -r--r--r--. 1 root root 67 Sep 29 23:42 console-efi-141204855000000
> 1225 -r--r--r--. 1 root root 148 Sep 29 23:59 console-efi-141204954200000
> 1224 -r--r--r--. 1 root root 67 Sep 29 23:59 console-efi-141204954400000
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@xxxxxx>
>
> --- linux-next/fs/pstore/inode.c.orig 2014-10-03 23:58:00.440386528 -0400
> +++ linux-next/fs/pstore/inode.c 2014-10-09 17:50:50.613829841 -0400
> @@ -320,10 +320,10 @@ int pstore_mkfile(enum pstore_type_id ty
> compressed ? ".enc.z" : "");
> break;
> case PSTORE_TYPE_CONSOLE:
> - sprintf(name, "console-%s", psname);
> + sprintf(name, "console-%s-%lld", psname, id);
> break;
> case PSTORE_TYPE_FTRACE:
> - sprintf(name, "ftrace-%s", psname);
> + sprintf(name, "ftrace-%s-%lld", psname, id);
> break;
> case PSTORE_TYPE_MCE:
> sprintf(name, "mce-%s-%lld", psname, id);
>
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/