Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1147873pxy; Fri, 23 Apr 2021 01:05:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUoBeYLwQFY8wR2/4NE5r8NkB38bjk59R5WbB7KZFnH4iq/c4LXOCFnCoPCOyi1NeYaokl X-Received: by 2002:a17:902:bc4a:b029:e9:8ae7:4091 with SMTP id t10-20020a170902bc4ab02900e98ae74091mr2592255plz.20.1619165112826; Fri, 23 Apr 2021 01:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619165112; cv=none; d=google.com; s=arc-20160816; b=GYMIUubP1llsf+JS2QW7wsIWAhYuRfxW7Cm+sJHIxYgpelVrXx2bxuIqAXfFto54e+ 2UOFK13+aRestgP64ZUbIu4qIk0iYoD8rg+GjLnholDhmdmptQ+1XXh1UvBS6xH5QS93 9vnWJiC1xt/2A4JZyaroCtxQR/HHInPW3Rstx9kt0ZYWRp+DPKxrSJyvryga46QCZoCi SvclEOCuo/UeEgwBg1wMvPCtJFBXfkUqwrxxhS5kj7j4N+o7MeLKgllwb2qd9WXJp+2N MRsCdExkHPi+gyoQUJR3Yy+OXnXJbbv5sshJN+nk8WDRocTUZMouzdKp6wPQLlYF9Ixq syhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=j1zxwFDS6qu6PLD49ByekUtY6xWD75BVhY6mdY2/v94=; b=fZboKIt2eeTYSv/RBChpy3EaueQBtR4aZouGdlbhaJ2c6GglIs+WFBZsP18Qs0jiQA 0S/XByeo7IK8qMQ4MhnuowiQvbi+nYfZr3CpH/TZPZWJ1NAckwbqmzMjqwDco2Thiawh qOErXseorlnaY9ctNCAZeUxrT69xEMxK7JL3eP/8yGu5XtmdvL0Bi83i8o01B2V4wxfC vhF1Gn7HWKoUGjdG9xVofHQdnRRykW94BajihmBKCMOrnOG/S60T81+RAFYLxg8Nx4Ok 2/u+XmfIl2Og21ul2FiwDJ3e+WAsoMK6aCnHTyVCqgmFRpH29O9xoOjs1Z6/unbpno77 IGbw== 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 r7si10612700pjp.99.2021.04.23.01.05.00; Fri, 23 Apr 2021 01:05:12 -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 S241243AbhDWIFC (ORCPT + 99 others); Fri, 23 Apr 2021 04:05:02 -0400 Received: from smtpout1.mo528.mail-out.ovh.net ([46.105.34.251]:60733 "EHLO smtpout1.mo528.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbhDWIFB (ORCPT ); Fri, 23 Apr 2021 04:05:01 -0400 Received: from pro2.mail.ovh.net (unknown [10.108.1.92]) by mo528.mail-out.ovh.net (Postfix) with ESMTPS id 854B6A1CE6C7; Fri, 23 Apr 2021 10:04:24 +0200 (CEST) Received: from localhost (89.70.221.198) by DAG2EX1.emp2.local (172.16.2.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 23 Apr 2021 10:04:24 +0200 Date: Fri, 23 Apr 2021 10:00:23 +0200 From: Tomasz Duszynski To: Alexandru Ardelean CC: Tomasz Duszynski , linux-iio , LKML , Jonathan Cameron , Lars-Peter Clausen Subject: Re: [PATCH] iio: core: fix ioctl handlers removal Message-ID: References: <20210422201415.46378-1-tomasz.duszynski@octakon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: X-Originating-IP: [89.70.221.198] X-ClientProxiedBy: DAG2EX2.emp2.local (172.16.2.12) To DAG2EX1.emp2.local (172.16.2.11) X-Ovh-Tracer-Id: 9189595042398493949 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrvdduuddguddvhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvuffkfhggtggujghisehttdertddttdejnecuhfhrohhmpefvohhmrghsiicuffhushiihihnshhkihcuoehtohhmrghsiidrughushiihihnshhkihesohgtthgrkhhonhdrtghomheqnecuggftrfgrthhtvghrnheptdehveethfffudetjeeftdekueehjeegjedvteffgfevkefffeegffeugeehgfejnecukfhppedtrddtrddtrddtpdekledrjedtrddvvddurdduleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhrohdvrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepthhomhgrshiirdguuhhsiiihnhhskhhisehotghtrghkohhnrdgtohhmpdhrtghpthhtoheplhgrrhhssehmvghtrghfohhordguvg Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 23, 2021 at 10:17:42AM +0300, Alexandru Ardelean wrote: > On Thu, Apr 22, 2021 at 11:26 PM Tomasz Duszynski > wrote: > > > > Currently ioctl handlers are removed twice. For the first time during > > iio_device_unregister() then later on inside > > iio_device_unregister_eventset() and iio_buffers_free_sysfs_and_mask(). > > Double free leads to kernel panic. > > > > Fix this by not touching ioctl handlers list directly but rather > > letting code responsible for registration call the matching cleanup > > routine itself. > > > > This change is missing this tag: > > Fixes: 8dedcc3eee3ac ("iio: core: centralize ioctl() calls to the main chardev") > > With that tag added: > Acked-by: Alexandru Ardelean > > Apologies for the breakage. No worries. Will append you ack to v2 then. > Also, I wasn't sure if Jonathan or anyone else wanted to do this change. > > Thanks for the patch > Alex > > > Signed-off-by: Tomasz Duszynski > > --- > > drivers/iio/industrialio-core.c | 3 --- > > 1 file changed, 3 deletions(-) > > > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > > index d92c58a94fe4..98944cfc7331 100644 > > --- a/drivers/iio/industrialio-core.c > > +++ b/drivers/iio/industrialio-core.c > > @@ -1939,9 +1939,6 @@ void iio_device_unregister(struct iio_dev *indio_dev) > > > > indio_dev->info = NULL; > > > > - list_for_each_entry_safe(h, t, &iio_dev_opaque->ioctl_handlers, entry) > > - list_del(&h->entry); > > - > > iio_device_wakeup_eventset(indio_dev); > > iio_buffer_wakeup_poll(indio_dev); > > > > -- > > 2.31.1 > >