From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4BDCC10F13 for ; Tue, 16 Apr 2019 23:53:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1FE42176F for ; Tue, 16 Apr 2019 23:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555458833; bh=tNUSSbph7BrAfrPXgasHDR0Q6ML38casCDDMJ5GaFxU=; h=Date:From:To:Subject:List-ID:From; b=J+Fg+1xjXAC1F7plQA9bxx4eRc6w2VNxskUE969/ElYY9mGM7Zbprno6YJsum0A70 udMu36Fv6tJuyV9p6n6zKLlUvnslk7MXbeoFA51xLHUzhncXZPuHIm50af/mMCfilV Zm3BHW2eSj2dc8eiSXkztIbjS14JjKXFd8aH+pV4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730878AbfDPXxw convert rfc822-to-8bit (ORCPT ); Tue, 16 Apr 2019 19:53:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41238 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728856AbfDPXxw (ORCPT ); Tue, 16 Apr 2019 19:53:52 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 41CC8E57; Tue, 16 Apr 2019 23:53:51 +0000 (UTC) Date: Tue, 16 Apr 2019 16:53:50 -0700 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, stable@vger.kernel.org, sergey.senozhatsky.work@gmail.com, ngupta@vflare.org, minchan@kernel.org, akpm@linux-foundation.org, jglisse@redhat.com Subject: + zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct.patch added to -mm tree Message-ID: <20190416235350.NIVru%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: zram: pass down the bvec we need to read into in the work struct has been added to the -mm tree. Its filename is zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jérôme Glisse Subject: zram: pass down the bvec we need to read into in the work struct When scheduling work item to read page we need to pass down the proper bvec struct which points to the page to read into. Before this patch it uses a randomly initialized bvec (only if PAGE_SIZE != 4096) which is wrong. Note that without this patch on arch/kernel where PAGE_SIZE != 4096 userspace could read random memory through a zram block device (thought userspace probably would have no control on the address being read). Link: http://lkml.kernel.org/r/20190408183219.26377-1-jglisse@redhat.com Signed-off-by: Jérôme Glisse Reviewed-by: Andrew Morton Cc: Minchan Kim Cc: Nitin Gupta Cc: Sergey Senozhatsky Cc: Signed-off-by: Andrew Morton --- drivers/block/zram/zram_drv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/block/zram/zram_drv.c~zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct +++ a/drivers/block/zram/zram_drv.c @@ -774,18 +774,18 @@ struct zram_work { struct zram *zram; unsigned long entry; struct bio *bio; + struct bio_vec bvec; }; #if PAGE_SIZE != 4096 static void zram_sync_read(struct work_struct *work) { - struct bio_vec bvec; struct zram_work *zw = container_of(work, struct zram_work, work); struct zram *zram = zw->zram; unsigned long entry = zw->entry; struct bio *bio = zw->bio; - read_from_bdev_async(zram, &bvec, entry, bio); + read_from_bdev_async(zram, &zw->bvec, entry, bio); } /* @@ -798,6 +798,7 @@ static int read_from_bdev_sync(struct zr { struct zram_work work; + work.bvec = *bvec; work.zram = zram; work.entry = entry; work.bio = bio; _ Patches currently in -mm which might be from jglisse@redhat.com are zram-pass-down-the-bvec-we-need-to-read-into-in-the-work-struct.patch mm-hmm-select-mmu-notifier-when-selecting-hmm-v2.patch mm-hmm-use-reference-counting-for-hmm-struct-v3.patch mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated.patch mm-hmm-improve-and-rename-hmm_vma_get_pfns-to-hmm_range_snapshot-v2.patch mm-hmm-improve-and-rename-hmm_vma_fault-to-hmm_range_fault-v3.patch mm-hmm-improve-driver-api-to-work-and-wait-over-a-range-v3.patch mm-hmm-add-default-fault-flags-to-avoid-the-need-to-pre-fill-pfns-arrays-v2.patch mm-hmm-mirror-hugetlbfs-snapshoting-faulting-and-dma-mapping-v3.patch mm-hmm-allow-to-mirror-vma-of-a-file-on-a-dax-backed-filesystem-v3.patch mm-hmm-add-helpers-to-test-if-mm-is-still-alive-or-not.patch mm-hmm-add-an-helper-function-that-fault-pages-and-map-them-to-a-device-v3.patch mm-hmm-add-an-helper-function-that-fault-pages-and-map-them-to-a-device-v3-fix.patch mm-hmm-convert-various-hmm_pfn_-to-device_entry-which-is-a-better-name.patch mm-mmu_notifier-helper-to-test-if-a-range-invalidation-is-blockable.patch mm-mmu_notifier-convert-user-range-blockable-to-helper-function.patch mm-mmu_notifier-convert-mmu_notifier_range-blockable-to-a-flags.patch mm-mmu_notifier-contextual-information-for-event-enums.patch mm-mmu_notifier-contextual-information-for-event-triggering-invalidation-v2.patch mm-mmu_notifier-use-correct-mmu_notifier-events-for-each-invalidation.patch mm-mmu_notifier-pass-down-vma-and-reasons-why-mmu-notifier-is-happening-v2.patch mm-mmu_notifier-mmu_notifier_range_update_to_read_only-helper.patch