Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1944449imm; Thu, 24 May 2018 03:21:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrgyME5RN6EBAWogCoxN2/ukW01cU/Udm01Gcyfi8aytGT5MMI7k1paa0hgzKIcqxzc390Y X-Received: by 2002:a62:ce4e:: with SMTP id y75-v6mr6501961pfg.175.1527157319073; Thu, 24 May 2018 03:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157319; cv=none; d=google.com; s=arc-20160816; b=ohTeYgitJoyi0CBE4Kkkx85yStNN0Bx794Vw7R58Wt9bQD9QgLbnp0bsOUNehLr/xt R61BCkwSX2xZZZpxJvNztLeSAgOBextQiTSdtbzDhhsGQpxEhgHbM3Ty7y0yBZXHWAYZ 3erqvyp9Tpv0VRolynLIZWcOs9eoBMs6rWzoKgb9DjACiWvD/jhPjZUzgFwkY0nIyxcY IMvX0mm5g86/LAhyChGYgQsGlilgGYM7rRDLy1eBMsi6A2Uo9o8tmABmvQNdIemk/ADn byzHy5rsdnysEZWQXaRsoOVaXSoIKjZU4Y0G1vcua393NU5cgY66WfEBDFxwKX6ERtFk 28ZQ== 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:dkim-signature :arc-authentication-results; bh=Lg6SXfWraEynMrS7HAdBNxj0jOjQ+vMvHQjLFbsBFbQ=; b=EuPc5WEuOePIeIv5VpXBFdhlK0XyfeGaSkuAZIvzuTlwamYPPHHT4LwGn3kHRbKs5E XTAt1ctoNFUt1Y7HeMohTfir/dTYFWjVb55GWBI3gfL6Rs1qedlI9iOvhKp4s4fk4tXw BYNiFd27WlSvYYiAbqkKd/8t5XKnpJft28PAJc/SyStnVNBQiIFtMznjrj3YrJNo5MFs JXPe2Y+LK1WAleB7C8wwAVdivemi534vXP/7FVmDzfDEPpfIGQiZIxAGsZZ3JVcWydM2 UTSsj62xOs6gSD/Cs6DEcFEFtRSWtD8Qc8BdQx/ei9jEPT5H8SPsX6uAyjZ1E189yrI/ edIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KUt8DjHZ; 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 e129-v6si21388984pfa.217.2018.05.24.03.21.44; Thu, 24 May 2018 03:21:59 -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=@kernel.org header.s=default header.b=KUt8DjHZ; 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 S1031922AbeEXKVC (ORCPT + 99 others); Thu, 24 May 2018 06:21:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:51740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031236AbeEXKDN (ORCPT ); Thu, 24 May 2018 06:03:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 41B2320890; Thu, 24 May 2018 10:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156192; bh=/zrjKaW6r5jRqILmqiWHoJYf9jf57imDBEyxn6JPd5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KUt8DjHZBtOQil4ZndMpE4JCfnwyfcSql52+1MoVpQg0IAetMIAz3/3+HaeR+TXzU Wy8A7J83mJaPqkiUU8n595CRHV5OlhiMzD1TPnW8M38UbcWCDmbWs0/GUxcQUSPmyF xAOLqbLMdEweQbRvVAzu4xrFXoHqaFTcYrDHrLtc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+7d26fc1eea198488deab@syzkaller.appspotmail.com, Alexander Potapenko , Douglas Gilbert , Johannes Thumshirn , "Martin K. Petersen" Subject: [PATCH 4.16 064/161] scsi: sg: allocate with __GFP_ZERO in sg_build_indirect() Date: Thu, 24 May 2018 11:38:09 +0200 Message-Id: <20180524093026.158541287@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Potapenko commit a45b599ad808c3c982fdcdc12b0b8611c2f92824 upstream. This shall help avoid copying uninitialized memory to the userspace when calling ioctl(fd, SG_IO) with an empty command. Reported-by: syzbot+7d26fc1eea198488deab@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Signed-off-by: Alexander Potapenko Acked-by: Douglas Gilbert Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1894,7 +1894,7 @@ retry: num = (rem_sz > scatter_elem_sz_prev) ? scatter_elem_sz_prev : rem_sz; - schp->pages[k] = alloc_pages(gfp_mask, order); + schp->pages[k] = alloc_pages(gfp_mask | __GFP_ZERO, order); if (!schp->pages[k]) goto out;