Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2440100imj; Mon, 11 Feb 2019 02:58:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IaxlP4qe/6ZYgGOk/kRZmnRDtdfb1vZ6kn23bnPPL/2ExCwGMLIIJofS77fEOMKjnftsavN X-Received: by 2002:a63:4005:: with SMTP id n5mr5061043pga.86.1549882681806; Mon, 11 Feb 2019 02:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549882681; cv=none; d=google.com; s=arc-20160816; b=GikQUT+b+cbNNu5o8FAFP5xJHoqB7pLs/+jiRZTgOjUiY0JQxFnYczSDXH2nXvUr+a +qhLlW+06euoOX/vE4n+7usHT3XsmOGmHtHBAjDP9wpTuKzlplgYMHNv4b6Xn1m3YMy/ sMpHv/bdIDQOKWG/cCnFSSnBn37x/MnBUhtc+0XdXjd6s8qQUmwRNI7p3VHS7Sl5r6PJ jJp27tzKHj6+2uhNv74ubayQZ6SiTDL3wz9H77DdwQLiFHdZndX1m5Kayq3EiT6KqusE cG5qcJrugH7P16wiaGv48YRCS/O7BdHDYBjdOB3MI42MrikbgP4ib/AtATlQHYECYWKy cKHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=dCW6ztwjgMg4sbaMj5zcHptp9RsWg8yoS4RoAsyH04c=; b=ntv4tEkA06uv7MA9HAdoXmV0sXMs+/Mn1Ih1pJ1F+NrQrQDeggwTDJTgeX1t+62OZe HhrYXVgyJRKBpd8VtfhKxDhOdHY5XwMLvUFml3jzcsnQ83TAvJuFOUk0QWzsEhc5nvSz rHpi3WoOvXt0LBvReXy2rpLmnKayCa7c5u9n0b0CoKWdRL1De6oK1F1PvcUZ5EwFOY6W EKHG1+uxOyw+iBrdoRPV9mCDro9Wu1J5lHXN39CHX5pDdFLLCzkHexDizlG78sDVplCJ mrbg1F6iFJ5i7lSBD/R0cDVcukU6bb2yY3invX2uFfdaEkE9jiECfekP1TfcuXPOtS8T 6wZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=XmomXnVb; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si9567017pga.270.2019.02.11.02.57.46; Mon, 11 Feb 2019 02:58:01 -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; dkim=pass header.i=@cisco.com header.s=iport header.b=XmomXnVb; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbfBKK5e (ORCPT + 99 others); Mon, 11 Feb 2019 05:57:34 -0500 Received: from rcdn-iport-9.cisco.com ([173.37.86.80]:62795 "EHLO rcdn-iport-9.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfBKK5e (ORCPT ); Mon, 11 Feb 2019 05:57:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2101; q=dns/txt; s=iport; t=1549882653; x=1551092253; h=from:to:cc:subject:date:message-id:references: content-transfer-encoding:mime-version; bh=PKp+vBW5YhtnRUcOkZqPKgkvgwkJlZrR50D/cnSJiJ0=; b=XmomXnVbF84BfbscScuWFZJF0PvF83pmZxloEQUA/Sajm9wepWy51EYL t7HP3J4vGpiK8X/k/8Qrpz/Z6QPf5dTG9tFvEzoMlVciAzKbyCyKeYWk+ 99UkxVkOBiicTVT9TLbzqe8gc1ynKHzR2P33suwUw9G7RlZB5by8ow6rM A=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AEAAA8VGFc/5pdJa1jGgEBAQEBAgE?= =?us-ascii?q?BAQEHAgEBAQGBUQUBAQEBCwGCA4FqJwqMFIttgg2CYYZJjmmBewsBAYRsgz0?= =?us-ascii?q?iNAkNAQMBAQIBAQJtKIVKAQEBAQIBJxM0CxACAQgOCh4QMiUCBAENBQiFBgM?= =?us-ascii?q?NCKofM4onjEMXgUA/hCOCV4IqhWACiW2YfzMJAo8UgzIhgW2FS4soijOGaYp?= =?us-ascii?q?5AhEUgScfOIFWcBU7gmyCKBeOHkExi0OBHwEB?= X-IronPort-AV: E=Sophos;i="5.58,358,1544486400"; d="scan'208";a="431355291" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by rcdn-iport-9.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2019 10:57:32 +0000 Received: from XCH-ALN-012.cisco.com (xch-aln-012.cisco.com [173.36.7.22]) by rcdn-core-3.cisco.com (8.15.2/8.15.2) with ESMTPS id x1BAvWCJ028142 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 11 Feb 2019 10:57:32 GMT Received: from xch-aln-012.cisco.com (173.36.7.22) by XCH-ALN-012.cisco.com (173.36.7.22) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 11 Feb 2019 04:57:31 -0600 Received: from xch-aln-012.cisco.com ([173.36.7.22]) by XCH-ALN-012.cisco.com ([173.36.7.22]) with mapi id 15.00.1395.000; Mon, 11 Feb 2019 04:57:31 -0600 From: "Hans Verkuil (hansverk)" To: Wen Yang , Hans Verkuil , Mauro Carvalho Chehab CC: Linux Media Mailing List , LKML Subject: Re: [PATCH 1/4] media: cec-notifier: fix possible object reference leak Thread-Topic: [PATCH 1/4] media: cec-notifier: fix possible object reference leak Thread-Index: AQHUwCH951ryS7AxYU2IkMLJINPqbQ== Date: Mon, 11 Feb 2019 10:57:31 +0000 Message-ID: <6b7fc837599e4069b876b32473b31746@XCH-ALN-012.cisco.com> References: <3ed515b78a404ec4a22b5f69ed9d6e28@XCH-ALN-012.cisco.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.61.175.13] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Outbound-SMTP-Client: 173.36.7.22, xch-aln-012.cisco.com X-Outbound-Node: rcdn-core-3.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/02/2019 11:38, Hans Verkuil (hansverk) wrote:=0A= > On 09/02/2019 03:48, Wen Yang wrote:=0A= >> put_device() should be called in cec_notifier_release(),=0A= >> since the dev is being passed down to cec_notifier_get_conn(),=0A= >> which holds reference. On cec_notifier destruction, it=0A= >> should drop the reference to the device.=0A= >>=0A= >> Fixes: 6917a7b77413 ("[media] media: add CEC notifier support")=0A= >> Signed-off-by: Wen Yang =0A= >> ---=0A= >> drivers/media/cec/cec-notifier.c | 1 +=0A= >> 1 file changed, 1 insertion(+)=0A= >>=0A= >> diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-no= tifier.c=0A= >> index dd2078b..621d4ae 100644=0A= >> --- a/drivers/media/cec/cec-notifier.c=0A= >> +++ b/drivers/media/cec/cec-notifier.c=0A= >> @@ -66,6 +66,7 @@ static void cec_notifier_release(struct kref *kref)=0A= >> container_of(kref, struct cec_notifier, kref);=0A= >> =0A= >> list_del(&n->head);=0A= >> + put_device(n->dev);=0A= >> kfree(n->conn);=0A= >> kfree(n);=0A= >> }=0A= >>=0A= > =0A= > Sorry, no. The dev pointer is just a search key that the notifier code lo= oks=0A= > for. It is not the notifier's responsibility to take a reference, that wo= uld=0A= > be the responsibility of the hdmi and cec drivers.=0A= =0A= Correction: the cec driver should never take a reference of the hdmi device= .=0A= It never accesses the HDMI device, it only needs the HDMI device pointer as= =0A= a key in the notifier list.=0A= =0A= The real problem is that several CEC drivers take a reference of the HDMI d= evice=0A= and never release it. So those drivers need to be fixed.=0A= =0A= Regards,=0A= =0A= Hans=0A= =0A= > =0A= > If you can demonstrate that there is an object reference leak, then pleas= e=0A= > provide the details: it is likely a bug elsewhere and not in the notifier= =0A= > code.=0A= > =0A= > BTW, your patch series didn't arrive on the linux-media mailinglist for= =0A= > some reason.=0A= > =0A= > Regards,=0A= > =0A= > Hans=0A= > =0A= =0A=