From patchwork Tue Feb 7 13:18:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9560051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0019760572 for ; Tue, 7 Feb 2017 13:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6DCB28410 for ; Tue, 7 Feb 2017 13:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA6A8283ED; Tue, 7 Feb 2017 13:20:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25C34204C2 for ; Tue, 7 Feb 2017 13:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754259AbdBGNUO (ORCPT ); Tue, 7 Feb 2017 08:20:14 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:18475 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbdBGNUN (ORCPT ); Tue, 7 Feb 2017 08:20:13 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v17DJBOj020522 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Feb 2017 13:19:11 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v17DJAP7005076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Feb 2017 13:19:10 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v17DJ98s008975; Tue, 7 Feb 2017 13:19:10 GMT Received: from mwanda (/154.0.138.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 07 Feb 2017 05:19:09 -0800 Date: Tue, 7 Feb 2017 16:18:41 +0300 From: Dan Carpenter To: Steve French , Pavel Shilovsky Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, kernel-janitors@vger.kernel.org Subject: [patch] CIFS: set *resp_buf_type to NO_BUFFER on error Message-ID: <20170207131841.GC31552@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We recently shuffled this code around and introduced a new error path before *resp_buf_type gets initialized. It creates uninitialized variable bugs in the callers. fs/cifs/smb2pdu.c:579 SMB2_negotiate() error: uninitialized symbol 'resp_buftype'. Fixes: 738f9de5cdb9 ("CIFS: Send RFC1001 length in a separate iov") Signed-off-by: Dan Carpenter Reviewed-by: Aurelien Aptel Reviewed-by: Pavel Shilovsky --- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 526f0533cb4e..8fa5e058fb15 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -807,6 +807,8 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses, struct kvec *new_iov; int rc; + *resp_buf_type = CIFS_NO_BUFFER; /* no response buf yet */ + new_iov = kmalloc(sizeof(struct kvec) * (n_vec + 1), GFP_KERNEL); if (!new_iov) return -ENOMEM;