Message ID | 1443616436-17565-1-git-send-email-srinivas.kandagatla@linaro.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBC27VH7PV4DBBAFOV6YAKGQEV5EHC3I@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 05D2122E23 for <linaro@patches.linaro.org>; Wed, 30 Sep 2015 12:35:13 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf21733755wic.2 for <linaro@patches.linaro.org>; Wed, 30 Sep 2015 05:35:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Yn3ZEiFKZaUBGrLtudjzdOS7jhY7rfxkS8srtBTdAbk=; b=P+FNiCFacpGs1rFACxLKc27WIty10gGPws8t7O3N5D3HWeI9bpGQbWH7YdBp+gDISX /4Xg/S0KWtBBjSFDl8QhMuKQYGYE33x12Z3Z5votCDC6NUdcWRX5jdOdQPZKylxdom/Z wZ2/ua3rB5mgWHQRgKQFJacLCZPq9GpeGBmx3pXq+rIon90jz1/qgHB3JaMR/zAFET2Y 9fr6R1uSIibD60N+cow8hZGGsO5yc80y6TB4aVLMSgnZu0pEnPOR+Hbkt9XKTOWBCbAV mfOzI8QwPvGPA/pXkT5UVQ3KPVS98SKAJI7lGmdW3XTVcp2qQWqFxx0xqIScA6LKWIZQ Y+Bg== X-Gm-Message-State: ALoCoQkuFqjdycjmFYo8OJ89gDVjNuntQWSXT+245wa8J3EommgwfO8EyEPzwAqo1kMdtqZbH/2o X-Received: by 10.194.6.170 with SMTP id c10mr504271wja.7.1443616512298; Wed, 30 Sep 2015 05:35:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.29.148 with SMTP id d142ls32387lfd.27.gmail; Wed, 30 Sep 2015 05:35:12 -0700 (PDT) X-Received: by 10.152.43.138 with SMTP id w10mr1073154lal.104.1443616512110; Wed, 30 Sep 2015 05:35:12 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id z5si191259laj.38.2015.09.30.05.35.12 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 05:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by labzv5 with SMTP id zv5so44288593lab.1 for <patchwork-forward@linaro.org>; Wed, 30 Sep 2015 05:35:12 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr1106911lbb.35.1443616511975; Wed, 30 Sep 2015 05:35:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2728627lbq; Wed, 30 Sep 2015 05:35:10 -0700 (PDT) X-Received: by 10.50.114.166 with SMTP id jh6mr4397365igb.47.1443616510773; Wed, 30 Sep 2015 05:35:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si20593140igg.5.2015.09.30.05.35.10; Wed, 30 Sep 2015 05:35:10 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932713AbbI3MfI (ORCPT <rfc822;pingbo.wen@linaro.org> + 30 others); Wed, 30 Sep 2015 08:35:08 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:33855 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932144AbbI3MfD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 30 Sep 2015 08:35:03 -0400 Received: by wicfx3 with SMTP id fx3so195108289wic.1 for <linux-kernel@vger.kernel.org>; Wed, 30 Sep 2015 05:35:02 -0700 (PDT) X-Received: by 10.180.198.178 with SMTP id jd18mr32201559wic.34.1443616502701; Wed, 30 Sep 2015 05:35:02 -0700 (PDT) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id s1sm17152218wik.16.2015.09.30.05.34.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 05:35:02 -0700 (PDT) From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: gregkh@linuxfoundation.org Cc: maxime.ripard@free-electrons.com, linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, linux-arm-kernel@lists.infradead.org, ZhengShunQian <zhengsq@rock-chips.com> Subject: [PATCH 1/4] nvmem: core: fix the out-of-range leak in read/write() Date: Wed, 30 Sep 2015 13:33:56 +0100 Message-Id: <1443616436-17565-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443616298-17389-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1443616298-17389-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d3c6676..f4af8e5 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj, int rc; /* Stop the user from reading */ - if (pos > nvmem->size) + if (pos >= nvmem->size) return 0; if (pos + count > nvmem->size) @@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, int rc; /* Stop the user from writing */ - if (pos > nvmem->size) + if (pos >= nvmem->size) return 0; if (pos + count > nvmem->size)