Received: by 10.192.165.148 with SMTP id m20csp948646imm; Wed, 2 May 2018 11:22:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqdZtRsDrrrsbEj8+g2XUoJ870yD8aXn6P4KIix1ZNoxfPHlprle4lpbqCrrVSkRaMP64gb X-Received: by 10.98.89.209 with SMTP id k78mr20307683pfj.54.1525285363743; Wed, 02 May 2018 11:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525285363; cv=none; d=google.com; s=arc-20160816; b=0lQm2vEiNkDUu+2LpCqd5EJ/ZjIhyeXQ0cxttJ6/isMwQC6+RmfKdTn4OptOon0jxh c05VjAkKjNQPAD5f8bz5ifSmWRHzj57hI6bLuvFQ6fcsxPgyDJ3eibNaF6b0eZRLVOUy TO3xBEh0I96CdHRT2z4Ktd3M/13aL+yjZEvRzf7pDwdlIxiIS+TN617tyAquZ8DWW2nt gplQSwAaX6X/2P6xOv7Zdauop/u3D4YQZ2yuSYw6Y5jiTi/UEFL11vUNFx3U3Fze+PMI DGb+lrjbxAdp140TyCCCNdaUvPPxRBmUj4VgIGzxh6QEufFX5H3rExcGK7xXm5LK8jTz 9UvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1n5et6ArwXKX53jXn1hYvFoCMF6sq7RJSCUA/O0Tzq8=; b=AWVwUDtJ74I3ITsK2/xMqXQLl1bjJvDSpCxWJMIte8TGgqj0UtNcLdHSkoWJIhy10z wUkLFFUJ+gq1frOPDy+/vCbkyINg8H2eqkhggLK6LRNr9yw/Ltw03cLDr/1wl/9MgJR3 vUSLBtmxnn1YxHr9X8b1Qp3CsYlHQ0Yo4wjdeH+KddSMFcvN9i8vIfnUQ2iCZ2J4Y9Vn fvySneijmcBXsSjhi8hbzrKhiSKuvkRwIgiKVohPwgrTx3d3/z6BHLQLDs4Z4k95SR5j /HWzJjQi5/qOpG0jtVG3UEwOq6rPgNbIZxcQ29Y7wNG22+oCLJQDLHvnmSkv3YekcHIk i3dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hmxHS0g3; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i135-v6si9831124pgc.346.2018.05.02.11.21.59; Wed, 02 May 2018 11:22:43 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hmxHS0g3; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751308AbeEBSRh (ORCPT + 99 others); Wed, 2 May 2018 14:17:37 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37950 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbeEBSRZ (ORCPT ); Wed, 2 May 2018 14:17:25 -0400 Received: by mail-wm0-f66.google.com with SMTP id i3so25944760wmf.3 for ; Wed, 02 May 2018 11:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1n5et6ArwXKX53jXn1hYvFoCMF6sq7RJSCUA/O0Tzq8=; b=hmxHS0g3X43f+/DNCcbhTm3b0b+QzgL4+weQQ+AmSZsXuE6aNu6x+AvlHpIt42ddkL PC+3d2XFre9N16CGqV53n+suA9aTtGP4I5mjggk0rOVrB6YVdMwN9+RcDuNYEXMUry+V 3Smx5tOWadzrOM0v1UIrKk9ZYM/lzeDk20cFEk/uesrCFh4gU6Iy9YJhM/KYhev9Vu2z C3WTm707xK9Crr8XmUrHhjVUhw2+mqqnM/MLcV9Ywgj8qEJDckqWLV3ttM8ELkGaogvS HCKKyeVCiMk0qGmJvcrrdwrVRis1rwtT9NtD9DHPZ2ul5lgxQvsjaGxU/ddsU3OQVes8 TmSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1n5et6ArwXKX53jXn1hYvFoCMF6sq7RJSCUA/O0Tzq8=; b=PO/LoyaVEYBTaShPGjKm2nFScvMeoQH+o8ykuOwPfesaFfDTlvIRjAb/sk9v6AWUcZ IqZxXyQBmQB/xHMC+YnFuK6WuRf2qAFVqmyAsDRgf/j7yLsg0buaS7SKN9Vp+8weCFFZ +0P0YARMVT/majVkt6Yfn/Ey8CqkpymY9QYI2WOqfYuNCiGGMvtQCOFkLS6UMBMSFcDE RPHIH40q4V+Rd+X47PbZb9/tvSZfXgj5cyWf7tZ3KpSnsgl2AlpJ3PptltfrgcMmKhfK 4C/nfixpvicwK1vsd1J5CZmNmgDKWRmD5WaJdHG5k5iI1qYKR7G9nHQi5wZXRUu4+vXo pwkg== X-Gm-Message-State: ALQs6tBd26GLIm/6VEU20EFS2aBOAFWRH7dVxpp5tC/c2J6gKL+4IsXq R5K6I+1MNeA0koHtQEgXI0w= X-Received: by 10.28.109.151 with SMTP id b23mr13416257wmi.86.1525285044219; Wed, 02 May 2018 11:17:24 -0700 (PDT) Received: from orange.brq.redhat.com. (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id t203sm12439379wmt.33.2018.05.02.11.17.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 May 2018 11:17:23 -0700 (PDT) From: Ilya Dryomov To: Al Viro Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc() Date: Wed, 2 May 2018 20:16:57 +0200 Message-Id: <1525285017-18616-2-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1525285017-18616-1-git-send-email-idryomov@gmail.com> References: <1525285017-18616-1-git-send-email-idryomov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make n signed to avoid leaking the pages array if __pipe_get_pages() fails. Signed-off-by: Ilya Dryomov --- lib/iov_iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 4d5bf40d399d..fdae394172fa 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1102,7 +1102,7 @@ static ssize_t pipe_get_pages_alloc(struct iov_iter *i, size_t *start) { struct page **p; - size_t n; + ssize_t n; int idx; int npages; -- 2.4.3