Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753064AbdFLXMW (ORCPT ); Mon, 12 Jun 2017 19:12:22 -0400 Received: from mail-sn1nam02on0137.outbound.protection.outlook.com ([104.47.36.137]:33813 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752534AbdFLXMU (ORCPT ); Mon, 12 Jun 2017 19:12:20 -0400 From: Pavel Shilovskiy To: Christophe JAILLET , "sfrench@samba.org" CC: "linux-cifs@vger.kernel.org" , "samba-technical@lists.samba.org" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: RE: [PATCH] CIFS: Fix some return values in case of error in 'crypt_message' Thread-Topic: [PATCH] CIFS: Fix some return values in case of error in 'crypt_message' Thread-Index: AQHS4oJC60/vlNdR50SwUcnTYWz6v6Ih3YlQ Date: Mon, 12 Jun 2017 23:12:17 +0000 Message-ID: References: <20170611071247.2038-1-christophe.jaillet@wanadoo.fr> In-Reply-To: <20170611071247.2038-1-christophe.jaillet@wanadoo.fr> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Ref=https://api.informationprotection.azure.com/api/72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetBy=pshilov@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2017-06-12T16:12:16.1435838-07:00; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General authentication-results: wanadoo.fr; dkim=none (message not signed) header.d=none;wanadoo.fr; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:d::4d0] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0280;7:CzkYnhtfNKf8fGhBezYV4O1mBoAnV2T0hG1U2nj/q7fv0JpaFm1Zx2ysrbMEZprRJgoJd2hB3ailPIpnXggyFosfdkI5+E2s1f1bQbAC7qjgGc1VhbUFgXo1LAQZfDyIAASoWdbFRVzooMIih5ifrkfyE5Amxga8NLWiCCkDj7JT0Azr/D+ioe/Y0Rt+D16ojch+/83RsvxkFm8fuEz8LyVHxLuPpTJie40Az9AUtldUxxkBMzk+fOA0ojHzl42GwR5EH1xipf1JGl/6yFfq1w6jt3kW0mUMQeweYGW+dcbl0TWs23YPgMVEv4qH4pF4Lb5o5guOCR+Jben1VRYlA4KJ9UPjIxWu45PNoazQc07x4CDsQUtn78u9B85UYE7r86h+xaAruHPitKGJMu/I8BE2a5BEVOhtyAZTMdB4f03ZVNihwod8bDYqMbLm0k8X9/4VI/SjzR99O9zm71xIbFpR3sDmctsqHOX/ej7m3N/Nl1RXL61/rxVrXbve3ex1zLwF4Lj/q2yOcnxF+js1zuOsi+z644fRJoFdgIqxewq6WoZ/DolxFYw0baN+12hJhpfZJMxSEXwg5GqpGQ408YGQQ40zy/1K6cu9cOIQ69r+ZHeORs/FesdnpAmLZclJd7x+jATKdil8LiAHAD04rmeVQAQbKM/DoTsZdgY4a2DaGV/02kBdKpsQy2QqehfqhiZ5xKoObioy6Vh1z3pSSDOJLmD+5N8PuNJdoPuuhUZqhKbvKseZXl0LHt/5XZMnWYZiOkqVOneECns9CVpqPevEz8Mr3AyLp3MEprkw3RfRinBDZiE3NjhVy0oEGIPI x-ms-office365-filtering-correlation-id: bbdc8446-7c93-4a02-40b2-08d4b1e87882 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:CY4PR21MB0280; x-ms-traffictypediagnostic: CY4PR21MB0280: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(155761271638844); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(61426038)(61427038)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR21MB0280;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR21MB0280; x-forefront-prvs: 03361FCC43 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(39840400002)(39400400002)(39450400003)(39410400002)(39850400002)(4326008)(3660700001)(10290500003)(10090500001)(8990500004)(305945005)(74316002)(8936002)(7736002)(478600001)(102836003)(7696004)(966005)(38730400002)(6246003)(2950100002)(5660300001)(55016002)(2501003)(77096006)(6506006)(54906002)(99286003)(189998001)(6436002)(229853002)(2900100001)(2906002)(3280700002)(122556002)(76176999)(86612001)(50986999)(54356999)(33656002)(86362001)(5005710100001)(14454004)(81166006)(8676002)(25786009)(6306002)(53936002)(9686003)(575784001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0280;H:CY4PR21MB0135.namprd21.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jun 2017 23:12:17.6851 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0280 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5CNCTea003035 Content-Length: 1690 Lines: 49 2017-06-11 0:12 GMT-07:00 Christophe JAILLET : > 'rc' is known to be 0 at this point. So if 'init_sg' or 'kzalloc' fails, we > should return -ENOMEM instead. > > Also remove a useless 'rc' in a debug message as it is meaningless here. > > Fixes: 026e93dc0a3ee ("CIFS: Encrypt SMB3 requests before sending") > Signed-off-by: Christophe JAILLET > --- > fs/cifs/smb2ops.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c > index c58691834eb2..cdcb3d95add8 100644 > --- a/fs/cifs/smb2ops.c > +++ b/fs/cifs/smb2ops.c > @@ -1809,7 +1809,8 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) > > sg = init_sg(rqst, sign); > if (!sg) { > - cifs_dbg(VFS, "%s: Failed to init sg %d", __func__, rc); > + cifs_dbg(VFS, "%s: Failed to init sg", __func__); > + rc = -ENOMEM; > goto free_req; > } > > @@ -1817,6 +1818,7 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc) > iv = kzalloc(iv_len, GFP_KERNEL); > if (!iv) { > cifs_dbg(VFS, "%s: Failed to alloc IV", __func__); > + rc = -ENOMEM; > goto free_sg; > } > iv[0] = 3; > -- > 2.11.0 > > -- > 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 Thanks for catching this. Reviewed-by: Pavel Shilovsky -- Best regards, Pavel Shilovsky