Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5576771imu; Tue, 29 Jan 2019 23:21:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN5w+Z06Ebn+cFmjG7tgCeZRyUDN7bo0c4PaSTwONOHBHVcyYfsv39rel/1KTLvCbmEvymfP X-Received: by 2002:a62:5b44:: with SMTP id p65mr29099727pfb.47.1548832863973; Tue, 29 Jan 2019 23:21:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548832863; cv=none; d=google.com; s=arc-20160816; b=ReP0N2mvuw4FQngyTa1+bDNuIJpme5t1Ng8CtLhduMsc5oGpvDO/4aSOFVxkpwEyp8 SS2OAcL/6kYBcSBgLiEJTgA4LRmv8xBm8oTSd6Q3GjpGbJTlb0T7Up80GCrsTbwGgsLs GqPJr8ARtjDCZl+quUz/1ca49ib5lYTVGyHrMEoghmHfK/ZSTnsnnn/c1ryhYz8mf/UD DJ2JS0bnWcHEHdVjfRgyJmBdV3G2UAVhCuqt6YORfPmx1ejRrg31MeBq6YnWC5jpYdAc nLgCT1HLuckhMnRFBOrusS4WGDyeKo6XJucfnG79VkNIp3hFvEYXaPbkxRNcxLkb1Jms 8Prw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ID06z4jHsV//rGiVqUbopJ+8VBAXHkHMzKFVOm/CSRE=; b=eG2yDyS/2j2Gid68Z6Vr5RjhMXltLZ+SByKxpp8IAilDdsgNwA/kUYjcoO4d89gNqN +nvtNj416OFAv3Vk9jrwJZSkLAg4ZXNF8Vcgf+rpDZKgbd+B5gzxO8WAybudHqsHFrTy 9iAXwEWTMRKobnVt7wr1lg2+bLCdK2KuG8oth74JLFGY0LjLR08gF3u3T2oTIcB2iQku LuMl6yvtW0vzS2MF2CjXOLlW1pOs1D1fpgISsuu6QIF0OYq63GWayspT3btjyECkr8rY PwWBEhiEu7DkQznHAIFfZOmtz0CZGGGLv3KUpd9aRoAILQhZRGFZX4yFEv3e4zD1DQJd /Umg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j191si710264pgd.31.2019.01.29.23.20.48; Tue, 29 Jan 2019 23:21:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729189AbfA3HT0 (ORCPT + 99 others); Wed, 30 Jan 2019 02:19:26 -0500 Received: from mga05.intel.com ([192.55.52.43]:2217 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbfA3HT0 (ORCPT ); Wed, 30 Jan 2019 02:19:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 23:19:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,540,1539673200"; d="scan'208";a="110943959" Received: from twinkler-lnx.jer.intel.com ([10.12.91.48]) by orsmga007.jf.intel.com with ESMTP; 29 Jan 2019 23:19:24 -0800 From: Tomas Winkler To: Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, Tomas Winkler Subject: [char-misc for v5.0] mei: free read cb on ctrl_wr list flush Date: Wed, 30 Jan 2019 10:12:26 +0200 Message-Id: <20190130081226.14315-1-tomas.winkler@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Usyskin There is a little window during disconnection flow when read cb is moved between lists and may be not freed. Remove moving read cbs explicitly during flash fixes this memory leak. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler --- drivers/misc/mei/client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 1fc8ea0f519b..ca4c9cc218a2 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -401,8 +401,11 @@ static void mei_io_list_flush_cl(struct list_head *head, struct mei_cl_cb *cb, *next; list_for_each_entry_safe(cb, next, head, list) { - if (cl == cb->cl) + if (cl == cb->cl) { list_del_init(&cb->list); + if (cb->fop_type == MEI_FOP_READ) + mei_io_cb_free(cb); + } } } -- 2.20.1