RE: [PATCH 3.18 36/68] Handle mismatched open calls

Pavel Shilovskiy
2017-07-19T18:39:17Z

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

2017-07-14 9:43 Ben Hutchings <ben@decadent.org.uk>:
> On Fri, 2017-05-05 at 11:32 -0700, Greg Kroah-Hartman wrote:
> > 3.18-stable review patch.  If anyone has any objections, please let me know.
> >
> > ------------------
> >
> > From: Sachin Prabhu <sprabhu@redhat.com>
> >
> > commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
> [...]
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
> >   .clear_stats = smb2_clear_stats,
> >   .print_stats = smb2_print_stats,
> >   .is_oplock_break = smb2_is_valid_oplock_break,
> > + .handle_cancelled_mid = smb2_handle_cancelled_mid,
> > + .handle_cancelled_mid = smb2_handle_cancelled_mid,
> >   .downgrade_oplock = smb2_downgrade_oplock,
> >   .need_neg = smb2_need_neg,
> >   .negotiate = smb2_negotiate,
> > @@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
> >   .print_stats = smb2_print_stats,
> >   .dump_share_caps = smb2_dump_share_caps,
> >   .is_oplock_break = smb2_is_valid_oplock_break,
> > + .handle_cancelled_mid = smb2_handle_cancelled_mid,
> > + .handle_cancelled_mid = smb2_handle_cancelled_mid,
> >   .downgrade_oplock = smb2_downgrade_oplock,
> >   .need_neg = smb2_need_neg,
> >   .negotiate = smb2_negotiate,
> [...]
>
> This doesn't look right. handle_cancelled_mid should be initialised once in each of the 3 smb_version_operations structures, shouldn't it?
>
> Ben.

Yes, you are right. Thanks for pointing it out.

Greg, I provided the patch to fix the above bug (see the attachment). Could you please look at it and apply to the 3.18.x kernel if it is suitable?

Best regards,
Pavel Shilovsky

[-- Attachment #2: 0001-CIFS-Fix-handle_cancelled_mid-callback-initializatio.patch --]
[-- Type: application/octet-stream, Size: 1884 bytes --]

From aa0d57e4dd351fa7492351509357514e93aab37b Mon Sep 17 00:00:00 2001
From: Pavel Shilovsky <pshilov@microsoft.com>
Date: Wed, 19 Jul 2017 11:26:02 -0700
Subject: [PATCH] CIFS: Fix handle_cancelled_mid callback initialization

Commit 99e214e006cf ("Handle mismatched open calls") was applied with
errors that result in initializing handle_cancelled_mid callback twice
in smb21_operations and smb30_operations structures but not initializing
it in smb20_operations structure.

Cc: <stable@vger.kernel.org> # 3.18.x
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
fs/cifs/smb2ops.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index a74f433..881af94 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1383,6 +1383,7 @@ struct smb_version_operations smb20_operations = {
.clear_stats = smb2_clear_stats,
.print_stats = smb2_print_stats,
.is_oplock_break = smb2_is_valid_oplock_break,
+ .handle_cancelled_mid = smb2_handle_cancelled_mid,
.downgrade_oplock = smb2_downgrade_oplock,
.need_neg = smb2_need_neg,
.negotiate = smb2_negotiate,
@@ -1462,7 +1463,6 @@ struct smb_version_operations smb21_operations = {
.print_stats = smb2_print_stats,
.is_oplock_break = smb2_is_valid_oplock_break,
.handle_cancelled_mid = smb2_handle_cancelled_mid,
- .handle_cancelled_mid = smb2_handle_cancelled_mid,
.downgrade_oplock = smb2_downgrade_oplock,
.need_neg = smb2_need_neg,
.negotiate = smb2_negotiate,
@@ -1545,7 +1545,6 @@ struct smb_version_operations smb30_operations = {
.dump_share_caps = smb2_dump_share_caps,
.is_oplock_break = smb2_is_valid_oplock_break,
.handle_cancelled_mid = smb2_handle_cancelled_mid,
- .handle_cancelled_mid = smb2_handle_cancelled_mid,
.downgrade_oplock = smb2_downgrade_oplock,
.need_neg = smb2_need_neg,
.negotiate = smb2_negotiate,
--
2.7.4