stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree
@ 2018-09-07 12:44 gregkh
  2018-12-20 20:03 ` Sudip Mukherjee
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2018-09-07 12:44 UTC (permalink / raw)
  To: richard, stable; +Cc: stable


The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 00ee8b60102862f4daf0814d12a2ea2744fc0b9b Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Mon, 11 Jun 2018 23:41:09 +0200
Subject: [PATCH] ubifs: Fix directory size calculation for symlinks

We have to account the name of the symlink and not the target length.

Fixes: ca7f85be8d6c ("ubifs: Add support for encrypted symlinks")
Cc: <stable@vger.kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 9da224d4f2da..e8616040bffc 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1123,8 +1123,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
 	struct ubifs_inode *ui;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
 	struct ubifs_info *c = dir->i_sb->s_fs_info;
-	int err, len = strlen(symname);
-	int sz_change = CALC_DENT_SIZE(len);
+	int err, sz_change, len = strlen(symname);
 	struct fscrypt_str disk_link;
 	struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
 					.new_ino_d = ALIGN(len, 8),
@@ -1151,6 +1150,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
 	if (err)
 		goto out_budg;
 
+	sz_change = CALC_DENT_SIZE(fname_len(&nm));
+
 	inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);

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

* Re: FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree
  2018-09-07 12:44 FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree gregkh
@ 2018-12-20 20:03 ` Sudip Mukherjee
  2018-12-20 20:21   ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Sudip Mukherjee @ 2018-12-20 20:03 UTC (permalink / raw)
  To: gregkh; +Cc: richard, stable

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Fri, Sep 07, 2018 at 02:44:47PM +0200, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 4.14-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

The attached backported patch should apply to 4.14-stable tree.

--
Regards
Sudip

[-- Attachment #2: 0001-ubifs-Fix-directory-size-calculation-for-symlinks.patch --]
[-- Type: text/x-diff, Size: 1551 bytes --]

>From b44c2499c02fa7409dbf104193cdfddeaf2316f5 Mon Sep 17 00:00:00 2001
From: Richard Weinberger <richard@nod.at>
Date: Mon, 11 Jun 2018 23:41:09 +0200
Subject: [PATCH] ubifs: Fix directory size calculation for symlinks

commit 00ee8b60102862f4daf0814d12a2ea2744fc0b9b upstream

We have to account the name of the symlink and not the target length.

Fixes: ca7f85be8d6c ("ubifs: Add support for encrypted symlinks")
Cc: <stable@vger.kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 fs/ubifs/dir.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index ef820f803176..4e6e32c0c08a 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1147,8 +1147,7 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
 	struct ubifs_inode *ui;
 	struct ubifs_inode *dir_ui = ubifs_inode(dir);
 	struct ubifs_info *c = dir->i_sb->s_fs_info;
-	int err, len = strlen(symname);
-	int sz_change = CALC_DENT_SIZE(len);
+	int err, sz_change, len = strlen(symname);
 	struct fscrypt_str disk_link = FSTR_INIT((char *)symname, len + 1);
 	struct fscrypt_symlink_data *sd = NULL;
 	struct ubifs_budget_req req = { .new_ino = 1, .new_dent = 1,
@@ -1189,6 +1188,8 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
 	if (err)
 		goto out_budg;
 
+	sz_change = CALC_DENT_SIZE(fname_len(&nm));
+
 	inode = ubifs_new_inode(c, dir, S_IFLNK | S_IRWXUGO);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
-- 
2.11.0


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

* Re: FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree
  2018-12-20 20:03 ` Sudip Mukherjee
@ 2018-12-20 20:21   ` Richard Weinberger
  2018-12-22  0:09     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2018-12-20 20:21 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: gregkh, stable

Sudip,

Am Donnerstag, 20. Dezember 2018, 21:03:39 CET schrieb Sudip Mukherjee:
> On Fri, Sep 07, 2018 at 02:44:47PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.14-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> The attached backported patch should apply to 4.14-stable tree.

Thanks a lot for finding and backporting this.
I somehow missed this failure notice. :(

Thanks,
//richard

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

* Re: FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree
  2018-12-20 20:21   ` Richard Weinberger
@ 2018-12-22  0:09     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2018-12-22  0:09 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: Sudip Mukherjee, gregkh, stable

On Thu, Dec 20, 2018 at 09:21:53PM +0100, Richard Weinberger wrote:
>Sudip,
>
>Am Donnerstag, 20. Dezember 2018, 21:03:39 CET schrieb Sudip Mukherjee:
>> On Fri, Sep 07, 2018 at 02:44:47PM +0200, gregkh@linuxfoundation.org wrote:
>> >
>> > The patch below does not apply to the 4.14-stable tree.
>> > If someone wants it applied there, or to any other stable or longterm
>> > tree, then please email the backport, including the original git commit
>> > id to <stable@vger.kernel.org>.
>>
>> The attached backported patch should apply to 4.14-stable tree.
>
>Thanks a lot for finding and backporting this.
>I somehow missed this failure notice. :(

Queued for 4.14, thanks all.

--
Thanks,
Sasha

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

end of thread, other threads:[~2018-12-22  0:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-07 12:44 FAILED: patch "[PATCH] ubifs: Fix directory size calculation for symlinks" failed to apply to 4.14-stable tree gregkh
2018-12-20 20:03 ` Sudip Mukherjee
2018-12-20 20:21   ` Richard Weinberger
2018-12-22  0:09     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).