Received: by 10.213.65.68 with SMTP id h4csp240323imn; Fri, 23 Mar 2018 03:41:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELswplsYY41tszTTw0NMj/fLYnVd9v0+0CMNl9nmvjfgNnnl/d+DgS2jTKP97V+eLV2bsMkh X-Received: by 10.101.98.205 with SMTP id m13mr20520102pgv.100.1521801675787; Fri, 23 Mar 2018 03:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521801675; cv=none; d=google.com; s=arc-20160816; b=QBo0doGWb5H0G7VbGcRLwBzxxGYU2//b3jMeAtvC4q/+oh+M/TEatCfxCcEyuPG4sr GL4+rH6fikbhnadG8vIvJrie7NgGRJ2fI7o5N+zfriyvOcasV8Ypi6sl9ZPamL4wLfEZ /KKamCnE9msyTHvCHp4f93twsSs7H1V6J0aCiUggwBU8PcP7LhDD4qY0sYf4GUJUdxle zTj/i/QONL4M6mK/j141dE7O61ozN+nZQl0R+dJGlNrEqb2s7uKTkyDBnf1dAOJUnH4A pAGHRCTCCVVfyogRPoWoZ26DPofNKlPLJqUI4shvluV6yT8m3JnREAmjay3kUgER8ZLu zq1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nzCWLY3V0C6PIV0nKvMtraF10iSVNu2ARmgwyQLsFlA=; b=TO9vNAoa79IseExCzJ9z1k24x3IacRIGbgoXcIryi2IPuTeIWcQhDUTEN7GFX5nEYM 4Cf2lcXM0HQKNRqy7FLkQSDGnc9kc6Dy/i05Y/UUFdMxny+hFawf04mWQa2adfDC28vO cvSaeD0GiP8j67wFNZp6sNW5UA5X9n6J/Re8/77CELwJDF/cW1oLD/GlvRKdBzkMq9vv CxxTvBoKFJGmBBsOrTE0sJC8affPKTl792oe1I5mc4Y/wn8YbTunA3D4rxzyaXQZJjZp F+GEiRDb/1DVdtbhFDK2g4zW31Yl5CQs5S4Ug+/Vx1hgeYCgeoDEFxOmvVi1Ikp5u1V/ qVdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si6470804pfd.404.2018.03.23.03.41.01; Fri, 23 Mar 2018 03:41:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933722AbeCWKQw (ORCPT + 99 others); Fri, 23 Mar 2018 06:16:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46818 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933688AbeCWKQo (ORCPT ); Fri, 23 Mar 2018 06:16:44 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C272CD7D; Fri, 23 Mar 2018 10:16:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Steve French , Sasha Levin Subject: [PATCH 4.4 69/97] cifs: small underflow in cnvrtDosUnixTm() Date: Fri, 23 Mar 2018 10:54:56 +0100 Message-Id: <20180323094201.475954266@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 564277eceeca01e02b1ef3e141cfb939184601b4 ] January is month 1. There is no zero-th month. If someone passes a zero month then it means we read from one space before the start of the total_days_of_prev_months[] array. We may as well also be strict about days as well. Fixes: 1bd5bbcb6531 ("[CIFS] Legacy time handling for Win9x and OS/2 part 1") Signed-off-by: Dan Carpenter Signed-off-by: Steve French Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/cifs/netmisc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -980,10 +980,10 @@ struct timespec cnvrtDosUnixTm(__le16 le cifs_dbg(VFS, "illegal hours %d\n", st->Hours); days = sd->Day; month = sd->Month; - if ((days > 31) || (month > 12)) { + if (days < 1 || days > 31 || month < 1 || month > 12) { cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, days); - if (month > 12) - month = 12; + days = clamp(days, 1, 31); + month = clamp(month, 1, 12); } month -= 1; days += total_days_of_prev_months[month];