public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] cmd: ubi: don't allow to rename a volume to a name that already exist
@ 2020-12-23 14:33 Philippe Reynes
  2021-01-05 12:53 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Reynes @ 2020-12-23 14:33 UTC (permalink / raw)
  To: u-boot

This commits add a check on the command ubi rename. This check avoids
to rename a volume to with a name that is already used on another ubi
volume. If two volumes has the same name, then the ubi device can't be
mounted anymore.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 cmd/ubi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index 171377cc66..cb14e3e1e7 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -264,6 +264,11 @@ static int ubi_rename_vol(char *oldname, char *newname)
 		return ENODEV;
 	}
 
+	if (!ubi_check(newname)) {
+		printf("%s: volume %s already exist\n", __func__, newname);
+		return EINVAL;
+	}
+
 	printf("Rename UBI volume %s to %s\n", oldname, newname);
 
 	if (ubi->ro_mode) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] cmd: ubi: don't allow to rename a volume to a name that already exist
  2020-12-23 14:33 [PATCH] cmd: ubi: don't allow to rename a volume to a name that already exist Philippe Reynes
@ 2021-01-05 12:53 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-01-05 12:53 UTC (permalink / raw)
  To: u-boot

On Wed, Dec 23, 2020 at 03:33:07PM +0100, Philippe Reynes wrote:

> This commits add a check on the command ubi rename. This check avoids
> to rename a volume to with a name that is already used on another ubi
> volume. If two volumes has the same name, then the ubi device can't be
> mounted anymore.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210105/e0ca38bd/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-23 14:33 [PATCH] cmd: ubi: don't allow to rename a volume to a name that already exist Philippe Reynes
2021-01-05 12:53 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox