From patchwork Tue Dec 10 04:47:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11281295 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27631930 for ; Tue, 10 Dec 2019 04:47:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F30C820726 for ; Tue, 10 Dec 2019 04:47:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P48L8SuA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbfLJErO (ORCPT ); Mon, 9 Dec 2019 23:47:14 -0500 Received: from mail-il1-f175.google.com ([209.85.166.175]:45191 "EHLO mail-il1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfLJErO (ORCPT ); Mon, 9 Dec 2019 23:47:14 -0500 Received: by mail-il1-f175.google.com with SMTP id p8so14910666iln.12 for ; Mon, 09 Dec 2019 20:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=l5k3tSvrzPlMHzPUGMTvQ4KRjgYVuYEZaaaA7axUuSo=; b=P48L8SuARty4OpEmtoJ7CI3z0GGWlMdEBgEXel4Kz0aYmlJ2+4RJhiMmd8LrP7Kloz P9r9/skplf7nkE3NdZJGdgikqpRnE7PzI5KJM1H2Sb2erTGWlO8zdfks+Ysp+Xlizphm cJz9R/n0GwtHz3OYtpMu30YReU+d7w39aEwwBh9GPLqAjoCFdEkDJUaj23J38xiq2HTw V3BqS6NtOPTtpel/NsDhh2AFyGLLTp9H29Wd1HLc47rUqgawezPQVxiROchjy85RBgYW H6Y0nSh1HxSkRMhazykN1qXQMzLQiSFCDw3gj9DEh6uFsARZGOVR3fl6FVbRuxcslzYJ 8y6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=l5k3tSvrzPlMHzPUGMTvQ4KRjgYVuYEZaaaA7axUuSo=; b=TlSb5LLgS7QPLEHarCkmHEPogYc+ZGw1IV1JHqMpU7C6dEnnFPQ24mOvNNN5yUQC1k FcR2AZVfuT33tK02dsCf341haheOxVaFj1ZENYqeMJwgE07Lh5YM8hpXMAlaYPC6j3EW bndrccj3z4q2lB3ybyVCmAW8z0dlCjFJDl8/Y2QQCofZTv+QLk5s4Qi/by5lYtAl2Dwf vFsqRdLHsBeHiVY9NyXjAUbbaMcLDOX31JM7rkoT9RdNs0sgqeSLsBuea5E42pg8Lq/3 Cg8dypKsueiBRvPvjHptGVEG6hDXxphfwVFiYGzj4eM0rrvec29p0ZdGtmH/xRRFL1oA 5yzQ== X-Gm-Message-State: APjAAAXCs17MxyO3sP/Ms4ed46tzLZLjWsZsjhGqTdM/qZQvAgQjrtX7 JSwXrGnwi8nRujzCQ0V/KiPQVrdxgelKDgfxVgiyCB9H X-Google-Smtp-Source: APXvYqwS797wuHDPMucTVMS5uFZjW4qjRjorojcnGYZ85IuMeWjA9aOWhBqtCkvvua9X8pWDgipE+0Yttvgzt6f8PmQ= X-Received: by 2002:a92:3dd0:: with SMTP id k77mr31517339ilf.3.1575953233227; Mon, 09 Dec 2019 20:47:13 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Mon, 9 Dec 2019 22:47:02 -0600 Message-ID: Subject: SMB3: Fix crash in SMB2_open_init due to uninitialized field in compounding path To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Ran into an intermittent crash in SMB2_open_init+0x2f6/0x970 due to oparms.cifs_sb not being initialized when called from: smb2_compound_op+0x45d/0x1690 Zero the whole oparms struct in the compounding path before setting up the oparms so we don't risk any uninitialized fields. Fixes: fdef665ba44a ("smb3: fix mode passed in on create for modetosid mount option") From d94a88c365cb53aee560c0de71948a258beefd5c Mon Sep 17 00:00:00 2001 From: Steve French Date: Mon, 9 Dec 2019 22:34:10 -0600 Subject: [PATCH 2/2] SMB3: Fix crash in SMB2_open_init due to uninitialized field in compounding path Ran into an intermittent crash in SMB2_open_init+0x2f6/0x970 due to oparms.cifs_sb not being initialized when called from: smb2_compound_op+0x45d/0x1690 Zero the whole oparms struct in the compounding path before setting up the oparms so we don't risk any uninitialized fields. Fixes: fdef665ba44a ("smb3: fix mode passed in on create for modetosid mount option") Signed-off-by: Steve French Acked-by: Ronnie Sahlberg --- fs/cifs/smb2inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 18c7a33adceb..5ef5e97a6d13 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -95,6 +95,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, goto finished; } + memset(&oparms, 0, sizeof(struct cifs_open_parms)); oparms.tcon = tcon; oparms.desired_access = desired_access; oparms.disposition = create_disposition; -- 2.23.0