From patchwork Fri Mar 27 05:28:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 6103511 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 30A57BF90F for ; Fri, 27 Mar 2015 05:29:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54967203F3 for ; Fri, 27 Mar 2015 05:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F11C203E5 for ; Fri, 27 Mar 2015 05:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752779AbbC0F2p (ORCPT ); Fri, 27 Mar 2015 01:28:45 -0400 Received: from mail-oi0-f46.google.com ([209.85.218.46]:33480 "EHLO mail-oi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbbC0F2n (ORCPT ); Fri, 27 Mar 2015 01:28:43 -0400 Received: by oifl3 with SMTP id l3so67882161oif.0; Thu, 26 Mar 2015 22:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qIt9mZqA65Frpc1sJ3bhJW0ybfPGnMGJ9OYG8apVrUc=; b=H9U2ad8WJppR62FSadwcANhr1B2q1xs/STbD/RgLMCgsuuhuR5qtcJRiFmtOZw163h K+Om3JKgts0je5zuVIwRBMlb9IQyFSwAFRmcd6vzU3KT4c+/3dOXvICkff/RNrTNzn/D UJrzTIc0a8X6rbGoos8ovGhi3XqKd34VgZmHHG823YKTd9FFdRNr4bQv7PEASd7q/LIp ZYjgCvmcZ20jfzgeyfKDrowfO2x9oDDQJtLcciEID+Vdx5YsPyl4M1jGM8aque3AcVrr MdpySzjqGU+/2KVzEoPQAitkJg/oUdNwKg4OqxYkedZ0yWKOGAGGbwjzzV0IcUG6gAA0 Igcw== X-Received: by 10.182.233.169 with SMTP id tx9mr5052847obc.38.1427434122476; Thu, 26 Mar 2015 22:28:42 -0700 (PDT) Received: from ubuntu.localdomain (cpe-68-203-16-26.austin.res.rr.com. [68.203.16.26]) by mx.google.com with ESMTPSA id mm3sm600258obb.1.2015.03.26.22.28.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Mar 2015 22:28:41 -0700 (PDT) From: Steve French To: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: smfrench@gmail.com Subject: [PATCH 2/4] [CIFS] Don't ignore errors on encrypting password in SMBTcon Date: Fri, 27 Mar 2015 00:28:00 -0500 Message-Id: <1427434082-4299-3-git-send-email-smfrench@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427434082-4299-1-git-send-email-smfrench@gmail.com> References: <1427434082-4299-1-git-send-email-smfrench@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Although unlikely to fail (and tree connect does not commonly send a password since SECMODE_USER is the default for most servers) do not ignore errors on SMBNTEncrypt in SMB Tree Connect. Reported by Coverity (CID 1226853) Signed-off-by: Steve French Acked-by: Shirish Pargaonkar ACKed-by: Sachin Prabhu Acked-by: --- fs/cifs/connect.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 4cb8450..cdb1aaf 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3696,6 +3696,12 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses, #endif /* CIFS_WEAK_PW_HASH */ rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, bcc_ptr, nls_codepage); + if (rc) { + cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n", + __func__, rc); + cifs_buf_release(smb_buffer); + return rc; + } bcc_ptr += CIFS_AUTH_RESP_SIZE; if (ses->capabilities & CAP_UNICODE) {