From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Nicolas Schichan <nschichan@freebox.fr>,
<george.kennedy@oracle.com>, <linux-kernel@vger.kernel.org>,
<linux-mtd@lists.infradead.org>, <richard@nod.at>,
<s.hauer@pengutronix.de>, <yi.zhang@huawei.com>
Subject: Re: [PATCH -next v3] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size
Date: Wed, 29 Mar 2023 17:54:21 +0200 [thread overview]
Message-ID: <20230329175421.3bd4906e@xps-13> (raw)
In-Reply-To: <2c2c2ce9-795b-4f76-cde9-db4a4066dcc1@huawei.com>
Hello,
chengzhihao1@huawei.com wrote on Sat, 25 Mar 2023 09:02:40 +0800:
> Hi,
> >
> >> Following process will make ubi attaching failed since commit
> >> 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size"):
> >>
> >> ID="0xec,0xa1,0x00,0x15" # 128M 128KB 2KB
> >> modprobe nandsim id_bytes=$ID
> >> flash_eraseall /dev/mtd0
> >> modprobe ubi mtd="0,2048" # set vid_hdr offset as 2048 (one page)
> >> (dmesg):
> >> ubi0 error: ubi_attach_mtd_dev [ubi]: VID header offset 2048 too large.
> >> UBI error: cannot attach mtd0
> >> UBI error: cannot initialize UBI, error -22
> >>
> >> Rework original solution, the key point is making sure
> >> 'vid_hdr_shift + UBI_VID_HDR_SIZE < ubi->vid_hdr_alsize',
> >> so we should check vid_hdr_shift rather not vid_hdr_offset.
> >> Then, ubi still support (sub)page aligined VID header offset.
aligned
> >>
> >> Fixes: 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size")
This commit has been backported to stable, so it is important this fix
also gets there quickly:
Cc: stable@vger.kernel.org
> >> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
> >> ---
> >> v2->v3: Use printing format '%zu' for UBI_VID_HDR_SIZE.
> >> drivers/mtd/ubi/build.c | 21 +++++++++++++++------
> >> 1 file changed, 15 insertions(+), 6 deletions(-)
> >
> > [...]
> >
> > Hello,
> >
> > Having had the problem, and found this patch as a fix, feel free to
> > add my:
> >
>
> Thanks for testing.
>
> > Tested-by: Nicolas Schichan <nschichan@freebox.fr>
Same here.
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com> # v5.10, v4.19
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Nicolas Schichan <nschichan@freebox.fr>,
<george.kennedy@oracle.com>, <linux-kernel@vger.kernel.org>,
<linux-mtd@lists.infradead.org>, <richard@nod.at>,
<s.hauer@pengutronix.de>, <yi.zhang@huawei.com>
Subject: Re: [PATCH -next v3] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size
Date: Wed, 29 Mar 2023 17:54:21 +0200 [thread overview]
Message-ID: <20230329175421.3bd4906e@xps-13> (raw)
In-Reply-To: <2c2c2ce9-795b-4f76-cde9-db4a4066dcc1@huawei.com>
Hello,
chengzhihao1@huawei.com wrote on Sat, 25 Mar 2023 09:02:40 +0800:
> Hi,
> >
> >> Following process will make ubi attaching failed since commit
> >> 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size"):
> >>
> >> ID="0xec,0xa1,0x00,0x15" # 128M 128KB 2KB
> >> modprobe nandsim id_bytes=$ID
> >> flash_eraseall /dev/mtd0
> >> modprobe ubi mtd="0,2048" # set vid_hdr offset as 2048 (one page)
> >> (dmesg):
> >> ubi0 error: ubi_attach_mtd_dev [ubi]: VID header offset 2048 too large.
> >> UBI error: cannot attach mtd0
> >> UBI error: cannot initialize UBI, error -22
> >>
> >> Rework original solution, the key point is making sure
> >> 'vid_hdr_shift + UBI_VID_HDR_SIZE < ubi->vid_hdr_alsize',
> >> so we should check vid_hdr_shift rather not vid_hdr_offset.
> >> Then, ubi still support (sub)page aligined VID header offset.
aligned
> >>
> >> Fixes: 1b42b1a36fc946 ("ubi: ensure that VID header offset ... size")
This commit has been backported to stable, so it is important this fix
also gets there quickly:
Cc: stable@vger.kernel.org
> >> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
> >> ---
> >> v2->v3: Use printing format '%zu' for UBI_VID_HDR_SIZE.
> >> drivers/mtd/ubi/build.c | 21 +++++++++++++++------
> >> 1 file changed, 15 insertions(+), 6 deletions(-)
> >
> > [...]
> >
> > Hello,
> >
> > Having had the problem, and found this patch as a fix, feel free to
> > add my:
> >
>
> Thanks for testing.
>
> > Tested-by: Nicolas Schichan <nschichan@freebox.fr>
Same here.
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com> # v5.10, v4.19
Thanks,
Miquèl
next prev parent reply other threads:[~2023-03-29 15:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 1:33 [PATCH -next v3] ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size Zhihao Cheng
2023-03-06 1:33 ` Zhihao Cheng
2023-03-24 16:19 ` Nicolas Schichan
2023-03-24 16:19 ` Nicolas Schichan
2023-03-25 1:02 ` Zhihao Cheng
2023-03-25 1:02 ` Zhihao Cheng
2023-03-29 15:54 ` Miquel Raynal [this message]
2023-03-29 15:54 ` Miquel Raynal
2023-03-29 21:33 ` Richard Weinberger
2023-03-29 21:33 ` Richard Weinberger
2023-04-14 23:12 ` Daniel Golle
2023-04-14 23:12 ` Daniel Golle
2023-04-15 18:25 ` Richard Weinberger
2023-04-15 18:25 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230329175421.3bd4906e@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=chengzhihao1@huawei.com \
--cc=george.kennedy@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nschichan@freebox.fr \
--cc=richard@nod.at \
--cc=s.hauer@pengutronix.de \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.