Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp241027pxu; Wed, 7 Oct 2020 01:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIGre8N9Lmg01GCHgeJbAvulCFj+ucHL160A56UaRg1NT1WX0IKSqawHKHcBkpHKPcrADp X-Received: by 2002:a50:9b14:: with SMTP id o20mr2256544edi.328.1602059936663; Wed, 07 Oct 2020 01:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602059936; cv=none; d=google.com; s=arc-20160816; b=pFLWfk+aloHcrhWZ8qtU7ihKrHM8J3uwZvvCk25RNQn+qcRl02hCa5V/uL2tzRf9Gl pqvl3AgCJywytXWbur/6Hlzc/HphHSJ5e9nf62yssbv/lqw4HT93ZlTrwkX7yjoH9fSI X3jSL3o4RpPD5CdSB/6G5z5qT6TNlXzdDZDS4XgaIVbxTlYTpcPYrB/Rct4ewOXio8hu l9SOWuDHORhHEYkaGo85njU09qs0pCVwa6w7KkWTNA1rSJ3Qbwi0KDxi+DaTTqDqbsO9 FRuAvIyL4jV/Tw83oHWkwD+gHvnG5j/jnynBPVdCfYWq/+mzz/X3fQ92r0c7y56pw4kB M98g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mxByRzXtS14P4/kqXsVlalifhyVtmDWn1V/36Wva2yE=; b=REipWmFIC3MedepknzGF+smPxzbAoxkSacpXcF6FqTtAGy/bP6ejr6FLepqR24YZ3D xESHKx+A780OEc8zsRdYcdlbdZfYga3k7ehp5t2EuNeh/6gGfmEAyohz+Io132as8UtL T/3hW65rCm6fYYcUqLNQHUQes3VLaNGyaaCnw+iyO0TNygRkB03r1eWbVrIFdqfjzDyT b3uYFcYy0n7Dy/SrCF8oJc/b+4B1Bk0t1Nd3DidYPJ+elc6D5+3JX03QGcVtgoH24+eH XyaKbWzJvDxVSeEDgo3EEVOXC64cMYxzror44dlni7MBd0lTdsWJsKnb1zpjvZBtmsiu VSEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zlkXAH7C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i62si981305edd.192.2020.10.07.01.38.32; Wed, 07 Oct 2020 01:38:56 -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; dkim=pass header.i=@linaro.org header.s=google header.b=zlkXAH7C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbgJGIdQ (ORCPT + 99 others); Wed, 7 Oct 2020 04:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbgJGIdQ (ORCPT ); Wed, 7 Oct 2020 04:33:16 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99EBFC061755 for ; Wed, 7 Oct 2020 01:33:15 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id i2so1126119ljg.4 for ; Wed, 07 Oct 2020 01:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mxByRzXtS14P4/kqXsVlalifhyVtmDWn1V/36Wva2yE=; b=zlkXAH7C+iLOICHOA8Pq+0jVGANDe3vr5yJxegEhyP9GdzD5Ro+DCLbvPEYzV9sXBV /2s8dUQa0i7Ctd5fV2h236vgbZzuI4gYBaNhs36z0Sl6ytH5y7kQ7XCDJnjJA6C3NS9y 7EnnC85Ao0BTyqqyh5W2iy12XQ+uf/4ftN4Xt2x93y/eVG9jivjPnkUUD38bRb4HL4Ss l4cHCTq6BXq91NwKjXPPOpt5EwvbZxDFhXFz45rdtQe08/cONAesVyvwvRdNHczv0t/c oVS+Cj6qES4lDsBQsgpD6RTypDAZVbyjbOzaW85ZcHLvvdBRyrAjJBRhUdWTj1my/SwQ fIWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mxByRzXtS14P4/kqXsVlalifhyVtmDWn1V/36Wva2yE=; b=K0M15BNGoaK44h/iTeKls2bQqavncNg3AodRLV4khB0MT2+Qz/rgdDzi1oxDRoob5Z ktNKiFAwIn3QxRXsUq05LbsxspC9mDukJSA+nbWy3v5EZQ6ufBbpoD+XZM6Gi2RM6qPK 4su5kwEK7Z5oL5UCt7K90Tv8rQuUjMHrf1ONpLrSwM3hUipKwPps39iskRxOlz9auwGL J8CBsFZUFomuqiW03Dvr7wfpHuiwyZxVNldvW5X/qGzCGIEImed0umWHF1DQ2uSL3AW9 rYZyVk2ma2AxNnlBILyVIAhu1AUWqFvPLACNUrvxYvY24P4oKQXGfSvchZj8t5XflSTl k6BA== X-Gm-Message-State: AOAM532e7u+OI1GGsU5vZ0H+gaUUKXQgOw1gG4JJmubm2zoNpvTn5Ob3 sIdT0APSj5z0khAoHn/LMpOsNX9kYz48mbrLwi3H3Q== X-Received: by 2002:a2e:3311:: with SMTP id d17mr830847ljc.293.1602059593872; Wed, 07 Oct 2020 01:33:13 -0700 (PDT) MIME-Version: 1.0 References: <20201001142511.3560143-1-enric.balletbo@collabora.com> In-Reply-To: <20201001142511.3560143-1-enric.balletbo@collabora.com> From: Linus Walleij Date: Wed, 7 Oct 2020 10:33:02 +0200 Message-ID: Subject: Re: [PATCH v3] pinctrl: mediatek: Free eint data on failure To: Enric Balletbo i Serra Cc: "linux-kernel@vger.kernel.org" , Collabora Kernel ML , Matthias Brugger , Nicolas Boichat , hsinyi@chromium.org, Sean Wang , Linux ARM , "open list:GPIO SUBSYSTEM" , "moderated list:ARM/Mediatek SoC support" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 1, 2020 at 4:25 PM Enric Balletbo i Serra wrote: > The pinctrl driver can work without the EINT resource, but, if it is > expected to have this resource but the mtk_build_eint() function fails > after allocating their data (because can't get the resource or can't map > the irq), the data is not freed and you end with a NULL pointer > dereference. Fix this by freeing the data if mtk_build_eint() fails, so > pinctrl still works and doesn't hang. Patch applied after rebasing it. It wasn't entirely trivial so check the result. This will not apply on elder kernels and is now targeted for v5.10. Fixes for v5.9 and stable will have to be backported once this is upstream. Yours, Linus Walleij