Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp219062pxb; Wed, 20 Oct 2021 20:35:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPRXvJnd+FGaxDZTaQugJ1e64f6sMMWwIGrGmjXmjZz+TPiYnLusrfmwB91KbZIqMGAUH4 X-Received: by 2002:a17:906:2599:: with SMTP id m25mr4170521ejb.302.1634787333541; Wed, 20 Oct 2021 20:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634787333; cv=none; d=google.com; s=arc-20160816; b=h2Ezyzbk5QnuvD8OLIDj5gLJyNzkcuFqo4bC857nCa+8/2Y+UbqIFuCv6sdSH2nMNV cF6rSUQzVYfZKrpuMuTDAJyUs2JCebeuJinPUQzZiOCRxO2CCeerxlg0amNhb8hEKPw1 ZnYyTHTgxMNLrIFRviezkug4MkpOGLVOaUXw7THpb3eifL6d1bMITuZveUN1S4LW8gLP dXkJzxRRDaXliK2heO2pWCQHhwuncK81hE+vd+yiyUoOKs5THSIu6mPAiq89Io9AKmCY kJw7KDFgk31BzUf/Pks6Y3xVnt/GLWirz9gWXUnzAJtQZvyDVWWKlOZkFBbSx5a7c0rx boiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Xw1pe3UyRBil3g8DL76TnUw45t+9FzdXXaK8pEDqzxk=; b=qhErD0kPuBQRQOOMS7Hz6JIJKzbXncw1VqqLEHM4hq5FHgJ5hRbTP4L+7rN+VSDgh1 BwTIl6r2oIZoW79hAWznPHw/YnXqtAI0efIwbz7P7S51cZbY9xy7SG330vO1+lkbTJjX ydBZQzkyaSgVfcIDEeiY/b6G9/PP8+o0ZVZGgorhY4C9Yoqwqf6SvEVnl0GnbrCPldSv geDXP6eH3Oxg477FePDMZIYuafgbgnaZduvkWelbFsqiqRvkbH4hGBhbtV3baW3dIkqn gYGpe6Z/mR8rLSuDri+/+jHBRUIc4WDz2Y0vZ+3NcbKtCpn1ck5jehsjvteeeQfVjTRq WO6A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si7174073edz.150.2021.10.20.20.34.55; Wed, 20 Oct 2021 20:35:33 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbhJUDcs (ORCPT + 99 others); Wed, 20 Oct 2021 23:32:48 -0400 Received: from mga17.intel.com ([192.55.52.151]:65520 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbhJUDcr (ORCPT ); Wed, 20 Oct 2021 23:32:47 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10143"; a="209727953" X-IronPort-AV: E=Sophos;i="5.87,168,1631602800"; d="scan'208";a="209727953" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2021 20:30:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,168,1631602800"; d="scan'208";a="444616242" Received: from unknown (HELO [10.239.154.68]) ([10.239.154.68]) by orsmga006.jf.intel.com with ESMTP; 20 Oct 2021 20:30:29 -0700 Subject: Re: [PATCH 1/2] i2c: virtio: disable timeout handling To: Viresh Kumar , Vincent Whitchurch Cc: Greg KH , Wolfram Sang , "virtualization@lists.linux-foundation.org" , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" , kernel References: <20211019094203.3kjzch7ipbdv7peg@vireshk-i7> <20211019143748.wrpqopj2hmpvblh4@vireshk-i7> <94aa39ab-4ed6-daee-0402-f58bfed0cadd@intel.com> <8e182ea8-5016-fa78-3d77-eefba7d58612@intel.com> <20211020064128.y2bjsbdmpojn7pjo@vireshk-i7> <01d9c992-28cc-6644-1e82-929fc46f91b4@intel.com> <20211020105554.GB9985@axis.com> <20211020110316.4x7tnxonswjuuoiw@vireshk-i7> From: Jie Deng Message-ID: Date: Thu, 21 Oct 2021 11:30:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211020110316.4x7tnxonswjuuoiw@vireshk-i7> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/10/20 19:03, Viresh Kumar wrote: > On 20-10-21, 12:55, Vincent Whitchurch wrote: >> If the timeout cannot be disabled, then the driver should be fixed to >> always copy buffers and hold on to them to avoid memory corruption in >> the case of timeout, as I mentioned in my commit message. That would be >> quite a substantial change to the driver so it's not something I'm >> personally comfortable with doing, especially not this late in the -rc >> cycle, so I'd leave that to others. > Or we can avoid clearing up and freeing the buffers here until the > point where the buffers are returned by the host. Until that happens, > we can avoid taking new requests but return to the earlier caller with > timeout failure. That would avoid corruption, by freeing buffers > sooner, and not hanging of the kernel. It seems similar to use "wait_for_completion". If the other side is hacked, the guest may never get the buffers returned by the host, right ? For this moment, we can solve the problem by using a hardcoded big value or disabling the timeout. Over the long term, I think the backend should provide that timeout value and guarantee that its processing time should not exceed that value.