Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp525370lqb; Thu, 14 Mar 2024 20:23:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzaY2CksED4QDJhfarIoT1k1T2kJ/tqDMGn83PRzbD43NkTH8f0Ydk6TQ9FpxlJ5Y4aud0gLg9t6ssgIrA956LDQD62X6jRbfxPjYbFw== X-Google-Smtp-Source: AGHT+IFz8GMmpe08z0E8EzzmQlmUiyoA4u4emHXyhyXQAfCJEd9bYSXesYp3RV5AaKQaG6YDRm45 X-Received: by 2002:a05:6a20:2489:b0:1a3:2de0:b00d with SMTP id m9-20020a056a20248900b001a32de0b00dmr1790463pzd.59.1710472992977; Thu, 14 Mar 2024 20:23:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710472992; cv=pass; d=google.com; s=arc-20160816; b=soORNiu/G/noV92l3IhCpWseVjOlfato/utazk0/ru1GQKuAGe9lgOZhhsY3udT/hH B/8q6f2Wu6NklkWUmfz3XBja7gDDUuhHFqYMx+OdoDHTkVeVfn8JmGI5utQGMx+lMtEU Ymwvbnlj57+BA58jtxvjfZM23zDhgeIBew4GhOKyTrbumOcmxNkvXPWMcK5CQZjKxKEJ A2V+CEpq3JJD5UXEIdMH8jvvNKo5qzQ2Sfd2jQBoURddH/0MpAtHdUR+NlTRkUHoGfxx vk0/ZqXQFNqK7fdEQ+tWsEMhTHhBnW9RYpIp3F2gctiYWTa12qwCL7dUcDMf1U8UVDcW g3xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=9RApS/dgoDW2OO187PDIQGg8As0KtloDMqq9iA6UnB0=; fh=TyzHK8LE+/dq6vQ4EIjCyKk1PWvMd5gbUFhE8nn4DRk=; b=N0etCGL5TvppsNnNzRXj8TszxZizdr6ozqQLZLOqjIcp0iigIlfhdwu0R86bZ/fI/E mZHVLpipgm6OgEHPLaJvzlTE5pF6zM5wo5BPcd3uIHj9WjGjU6/76RBtEdfQRqARD/9H IV8AvReypKVVIzAZB/8lIHr+pZU7VaHzK7op2TDfCjeypY7alRgy4rvsy4nhVpbYTaVN ImkEBO7rNZ7H6H1uNNNrzQwPQ47OhWLMXODqS7e5DiUzc6p2awVsxHFnj4jpmsoqodD1 d/HN1uJWC6u2Hx9X67YVNT8X74b3Mu0Kbm6ES1TYxRd9OGEGqWohkUdjPjhps6GM1HQX qtUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=S4U5o89N; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-104016-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x16-20020a170902ec9000b001dd97ce4a74si2888371plg.114.2024.03.14.20.23.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 20:23:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104016-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=S4U5o89N; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-104016-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104016-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9A367282DEC for ; Fri, 15 Mar 2024 03:23:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B46CD518; Fri, 15 Mar 2024 03:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="S4U5o89N" Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 865F66119 for ; Fri, 15 Mar 2024 03:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710472987; cv=none; b=bWmi/68xjUI6f98sx8J22cCNmtfsEDP2yc9BDvVw5Mph6intUarZyRs7gyY/BF84Uw266l7U9CiqbsKScY6zIvvJyvgx/b6A/HNyrCcxqyHGcAbrPaPmZSD/MPvfGUyjteISf7tdjR70sz1LPKz5Bma//VO6p9A5yV+ogVkYlxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710472987; c=relaxed/simple; bh=RsDlM7XRmRWsJCRyi7nBTGErp8a6/KNRPan9fsKzZ7g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=desVO4xHmYU65gqriat9HQsSnGdsPSs8nDkq91qZN4pqozaD0C7wfPT73NqI28vu/2XqPGko//oDdjE8n7R5Re5sWB7v1r8+LGV9j5dPuAl8Ld1Wsb35iApabtoaKYMlHIZVfrAhGD6lk0Tg4aa8qITMOs+OO2o7bpWP/v9sUh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=S4U5o89N; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1710472975; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=9RApS/dgoDW2OO187PDIQGg8As0KtloDMqq9iA6UnB0=; b=S4U5o89N5knlu3fUUofAHzqsziMfM9870PgxeJKFpVktWHisovp6y0iFUKZcPfGN8e2TvguJ17XjfflTOrRNWbrpTRgPGBPdVLUfo2dgZweQXsT7VMtjHsbzX2HguXKF7sJ0yfqUyMFnl7I+oc5XOgt1rHr/o4hIn1Y6mv7eluk= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=lulie@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W2UXS.C_1710472974; Received: from 30.221.128.90(mailfrom:lulie@linux.alibaba.com fp:SMTPD_---0W2UXS.C_1710472974) by smtp.aliyun-inc.com; Fri, 15 Mar 2024 11:22:55 +0800 Message-ID: <2f93789c-e931-452a-9b42-43c3254b626f@linux.alibaba.com> Date: Fri, 15 Mar 2024 11:22:53 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] relay: avoid relay_open_buf inproperly fails in buffer-only mode To: zhangzhengming Cc: akpm@linux-foundation.org, alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, gregkh@linuxfoundation.org, guwen@linux.alibaba.com, hengqi@linux.alibaba.com, kunyu@nfschina.com, linux-kernel@vger.kernel.org, nabijaczleweli@nabijaczleweli.xyz, xuanzhuo@linux.alibaba.com, zhao_lei1@hoperun.com, zhou.kete@h3c.com References: <20240220105836.15815-1-lulie@linux.alibaba.com> <20240315023912.13390-1-zhang.zhengming@h3c.com> From: Philo Lu In-Reply-To: <20240315023912.13390-1-zhang.zhengming@h3c.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/3/15 10:39, zhangzhengming wrote: >> diff --git a/kernel/relay.c b/kernel/relay.c >> index a8e90e98bf2c..0d8b8325530a 100644 >> --- a/kernel/relay.c >> +++ b/kernel/relay.c >> @@ -391,12 +391,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu) >> goto free_buf; >> relay_set_buf_dentry(buf, dentry); >> } else { >> - /* Only retrieve global info, nothing more, nothing less */ >> + /* In buffer-only mode, relay_open_buf is called with >> + * filename=NULL, but create_buf_file is still needed to >> + * retrieve is_global info. So dentry should be NULL here. >> + */ >> dentry = chan->cb->create_buf_file(NULL, NULL, >> S_IRUSR, buf, >> &chan->is_global); >> - if (IS_ERR_OR_NULL(dentry)) >> - goto free_buf; >> } >> >> buf->cpu = cpu; > I suggest replacing IS_ERR_OR_NULL with IS_ERR instead of removing it due to the possibility of create_buf_file callback returning an error. > This would be fine. AFAICT the return value here is un-important. So reverting to `WARN_ON(dentry)` maybe another choice.