Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3217080pxa; Tue, 18 Aug 2020 09:25:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUtsB2kr6Pfyw/7hFkpJamBMNDa164UVS+WmhAq3KmfyAPjnC+/P91w5Xkaci5CqMDqy0I X-Received: by 2002:a17:906:3f91:: with SMTP id b17mr19954854ejj.165.1597767915548; Tue, 18 Aug 2020 09:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597767915; cv=none; d=google.com; s=arc-20160816; b=zz+4cAx+mgWpYoCgojxQ/uIJZ6KDTRqFbFMWVKLFqbIAiv9BTYiQpCn6n4LBSDkvn7 Tdn3P/Dh1OTDZWOnzSP9/xItGbTolxRBMQdlvH7hu/D5NLEAxec2DlH8wOJCtLgfhZqj X/nvqGmOEealt5sHBKzCJJGFel+48wxS3JCEC3yo8fOectM8hTodHvCcc/7XVlyx+QOw uPSHaqg16MLpvpXoTzjNYOmNTeiM/ROzfXx726HGWODLFyXerowvElxQxIuvY4W+nWa6 AKErZDrRvnN9wdKvwOusKK6Hqkmsb1UXznTr/mINQz2TremAQJ8RO8ypffdKKF61xI3y l/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZAzkF/rSJbG1dXckfwa7/iOKQc8gCgTfQ3VyM9CnGe8=; b=XdapUcr4YVx7o7Gq8bKzZYcVwns5Su/QGeDFDnUxYKgF72o0r2dPtowUEpI5qJTMpJ H0W4r1reJECDv0eMeE24Y609R2+nf43IqHF7fGku1F13uRqh1mrnhiQ9jJjl60F0UKFz CnTY23FQS2TMkSmXAt1dlvxuNDYoToglrm0Nfo7JxCP4pHW6EOE0MzbpyrbcVfBSZvGW FihjgXeY/8nk1Up/mKrytSoYD3AIVlmvXlRMU6hL0k3awXxdlhJvvmS8SYwrRuRCYrg9 Bm+gzO6kh0qu0H6jxRDUHt424Z+KGv15XvCiZJPVBifJNJuaH16U4cSgJLbypisspHGH 5fag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si14084892ejr.295.2020.08.18.09.24.51; Tue, 18 Aug 2020 09:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbgHRQYK (ORCPT + 99 others); Tue, 18 Aug 2020 12:24:10 -0400 Received: from verein.lst.de ([213.95.11.211]:34171 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726398AbgHRQYI (ORCPT ); Tue, 18 Aug 2020 12:24:08 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id D0D1368AFE; Tue, 18 Aug 2020 18:24:04 +0200 (CEST) Date: Tue, 18 Aug 2020 18:24:04 +0200 From: Christoph Hellwig To: Coly Li Cc: 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, linux-kernel@vger.kernel.org, Chaitanya Kulkarni , Christoph Hellwig , Hannes Reinecke , Jan Kara , Jens Axboe , Mikhail Skorzhinskii , Philipp Reisner , Sagi Grimberg , Vlastimil Babka , stable@vger.kernel.org Subject: Re: [PATCH v7 1/6] net: introduce helper sendpage_ok() in include/linux/net.h Message-ID: <20200818162404.GA27196@lst.de> References: <20200818131227.37020-1-colyli@suse.de> <20200818131227.37020-2-colyli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200818131227.37020-2-colyli@suse.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I think we should go for something simple like this instead: --- From 4867e158ee86ebd801b4c267e8f8a4a762a71343 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 18 Aug 2020 18:19:23 +0200 Subject: net: bypass ->sendpage for slab pages Sending Slab or tail pages into ->sendpage will cause really strange delayed oops. Prevent it right in the networking code instead of requiring drivers to work around the fact. Signed-off-by: Christoph Hellwig --- net/socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/socket.c b/net/socket.c index dbbe8ea7d395da..fbc82eb96d18ce 100644 --- a/net/socket.c +++ b/net/socket.c @@ -3638,7 +3638,12 @@ EXPORT_SYMBOL(kernel_getpeername); int kernel_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) { - if (sock->ops->sendpage) + /* + * sendpage does manipulates the refcount of the passed in page, which + * does not work for Slab pages, or for tails of non-__GFP_COMP + * high order pages. + */ + if (sock->ops->sendpage && !PageSlab(page) && page_count(page) > 0) return sock->ops->sendpage(sock, page, offset, size, flags); return sock_no_sendpage(sock, page, offset, size, flags); -- 2.28.0