Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de> To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, netdev@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, ceph-devel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Coly Li <colyli@suse.de>, Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>, Chris Leech <cleech@redhat.com>, Christoph Hellwig <hch@lst.de>, Cong Wang <amwang@redhat.com>, "David S . Miller" <davem@davemloft.net>, Hannes Reinecke <hare@suse.de>, Ilya Dryomov <idryomov@gmail.com>, Jan Kara <jack@suse.com>, Jeff Layton <jlayton@kernel.org>, Jens Axboe <axboe@kernel.dk>, Lee Duncan <lduncan@suse.com>, Mike Christie <michaelc@cs.wisc.edu>, Mikhail Skorzhinskii <mskorzhinskiy@solarflare.com>, Philipp Reisner <philipp.reisner@linbit.com>, Sagi Grimberg <sagi@grimberg.me>, stable@vger.kernel.org, Vasily Averin <vvs@virtuozzo.com>, Vlastimil Babka <vbabka@suse.com> Subject: [PATCH v6 0/6] Introduce sendpage_ok() to detect misused sendpage in network related drivers Date: Tue, 18 Aug 2020 20:47:30 +0800 [thread overview] Message-ID: <20200818124736.5790-1-colyli@suse.de> (raw) This series was original by a bug fix in nvme-over-tcp driver which only checked whether a page was allocated from slab allcoator, but forgot to check its page_count: The page handled by sendpage should be neither a Slab page nor 0 page_count page. As Sagi Grimberg suggested, the original fix is refind to a more common inline routine: static inline bool sendpage_ok(struct page *page) { return (!PageSlab(page) && page_count(page) >= 1); } If sendpage_ok() returns true, the checking page can be handled by the zero copy sendpage method in network layer. The first patch in this series introduces sendpage_ok() in header file include/linux/net.h, the second patch fixes the page checking issue in nvme-over-tcp driver, the third patch adds page_count check by using sendpage_ok() in do_tcp_sendpages() as Eric Dumazet suggested, and all rested patches just replace existing open coded checks with the inline sendpage_ok() routine. Coly Li Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Cc: Chris Leech <cleech@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Cong Wang <amwang@redhat.com> Cc: David S. Miller <davem@davemloft.net> Cc: Hannes Reinecke <hare@suse.de> Cc: Ilya Dryomov <idryomov@gmail.com> Cc: Jan Kara <jack@suse.com> Cc: Jeff Layton <jlayton@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Lee Duncan <lduncan@suse.com> Cc: Mike Christie <michaelc@cs.wisc.edu> Cc: Mikhail Skorzhinskii <mskorzhinskiy@solarflare.com> Cc: Philipp Reisner <philipp.reisner@linbit.com> Cc: Sagi Grimberg <sagi@grimberg.me> Cc: stable@vger.kernel.org Cc: Vasily Averin <vvs@virtuozzo.com> Cc: Vlastimil Babka <vbabka@suse.com> --- Changelog: v6: fix page check in do_tcp_sendpages(), and replace other open coded checks with sendpage_ok() in libceph, iscsi drivers. v5, include linux/mm.h in include/linux/net.h v4, change sendpage_ok() as an inline helper, and post it as separate patch. v3, introduce a more common sendpage_ok() v2, fix typo in patch subject v1, the initial version. Coly Li (6): net: introduce helper sendpage_ok() in include/linux/net.h nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage() tcp: use sendpage_ok() to detect misused .sendpage drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage() scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map() libceph: use sendpage_ok() in ceph_tcp_sendpage() drivers/block/drbd/drbd_main.c | 2 +- drivers/nvme/host/tcp.c | 7 +++---- drivers/scsi/libiscsi_tcp.c | 2 +- include/linux/net.h | 16 ++++++++++++++++ net/ceph/messenger.c | 2 +- net/ipv4/tcp.c | 3 ++- 6 files changed, 24 insertions(+), 8 deletions(-) -- 2.26.2
next reply other threads:[~2020-08-18 12:47 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-18 12:47 Coly Li [this message] 2020-08-18 12:47 ` [PATCH v6 1/6] net: introduce helper sendpage_ok() in include/linux/net.h Coly Li 2020-08-18 12:47 ` [PATCH v6 2/6] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage() Coly Li 2020-08-18 12:47 ` [PATCH v6 3/6] tcp: use sendpage_ok() to detect misused .sendpage Coly Li 2020-08-18 12:47 ` [PATCH v6 4/6] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage() Coly Li 2020-08-18 12:47 ` [PATCH v6 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map() Coly Li 2020-08-18 12:47 ` [PATCH v6 6/6] libceph: use sendpage_ok() in ceph_tcp_sendpage() Coly Li
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200818124736.5790-1-colyli@suse.de \ --to=colyli@suse.de \ --cc=amwang@redhat.com \ --cc=axboe@kernel.dk \ --cc=ceph-devel@vger.kernel.org \ --cc=chaitanya.kulkarni@wdc.com \ --cc=cleech@redhat.com \ --cc=davem@davemloft.net \ --cc=hare@suse.de \ --cc=hch@lst.de \ --cc=idryomov@gmail.com \ --cc=jack@suse.com \ --cc=jlayton@kernel.org \ --cc=lduncan@suse.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=linux-scsi@vger.kernel.org \ --cc=michaelc@cs.wisc.edu \ --cc=mskorzhinskiy@solarflare.com \ --cc=netdev@vger.kernel.org \ --cc=open-iscsi@googlegroups.com \ --cc=philipp.reisner@linbit.com \ --cc=sagi@grimberg.me \ --cc=stable@vger.kernel.org \ --cc=vbabka@suse.com \ --cc=vvs@virtuozzo.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).