lkml.org 
[lkml]   [2021]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 3/4] mtd: core: protect access to MTD devices while in suspend
On Tue, 26 Oct 2021 07:55:50 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> @@ -1406,6 +1423,7 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
> const u_char *buf)
> {
> struct mtd_info *master = mtd_get_master(mtd);
> + int ret;
>
> *retlen = 0;
> if (!master->_panic_write)
> @@ -1419,8 +1437,12 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
> if (!master->oops_panic_write)
> master->oops_panic_write = true;
>
> - return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len,
> - retlen, buf);
> + mtd_start_access(master);
> + ret = master->_panic_write(master, mtd_get_master_ofs(mtd, to), len,
> + retlen, buf);
> + mtd_end_access(master);
> +
> + return ret;
> }

I suspect panic_write should be an exception, otherwise a panic in the
suspend path would never be able to write its data to the flash.

\
 
 \ /
  Last update: 2021-11-01 08:42    [W:0.074 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site