Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1067351lqp; Fri, 22 Mar 2024 04:53:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8I0+KZnvmaEZzT2312qKGGWFiOVlXVQTMjio5PLdNtkbgaq0vnfks8fj/px9/dBxtUCsw0a02qnjlOtiuTuW5M42BTvwI5NfRK+1dNA== X-Google-Smtp-Source: AGHT+IGPdoZrUiylG0W8pASz7q7qgOA1jNe6YmSfxcxk71ZKiI0RHTJiHuZE+2ymIlwYYfmcAzKg X-Received: by 2002:a05:6214:1d26:b0:690:452b:ecbb with SMTP id f6-20020a0562141d2600b00690452becbbmr2180293qvd.39.1711108421653; Fri, 22 Mar 2024 04:53:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711108421; cv=pass; d=google.com; s=arc-20160816; b=fUjqYFiDJjFglANIbyGpHSxbdF6AVQWuRP3N5p+QaAVRNaiyc3VtZDXo0fz0p9QA+0 RHBQ+M5+uN7RixHUbHSNJrATpsbD5ljiY/mA1FzAu5OdCBL7IRvMLRt3w8dk8+Ls0K/t BZkndUh0rNTbKXPnQxVUlHuKijFqtz+utE/rW2M6eDpBlWe+AzDg41/y28x/yu6R53QC xyhY8YmgYea6IJ27ewvPT90b6ZZIET4I/jfdTLAsRqpxqkNprE1R9c4nCXkThat+oZFj jyY+QGrSe00KxWGv5uEq2LXF8H0sLxFcXeulA3ULje7VSfwwX6pYC1QWr9QbRsdyTnlE eCKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=hVWFUDwpLHRWKDYEaq1Gc8i1EAEVOWiexCNmJxdcxRk=; fh=l8k43R3Nnsze7vEJ34/9Zhk1xRhE5bafkNufuAab0L0=; b=Odlm3MA5Ks34uam5pRIVPnvDkgHXZgtm964ZzIkvOWVRIdK4ZZRBpDgtSQJ9xQdOJS 6EsLXpVArPQzODKVbcDuq1Qm87m+hiLAF7O7lJdLU+L6R/NYebWZB5RKyjw/trRktFp3 yD1/jbaaBTy5vyWxD6q3Aies8XplJVvclAYcvjfw2lJDLZaOW9WTiUu7Zac1jc1BSUBw 4bNGfjwpGhbzFBU3+9DOwXlArBTYpIgYPJ3mkIlIhc36zCSYTXMVOA5COqyGpbJYK+VR Jf0gaipV7LE3U2wC6QdGV6A1MorsHIAdrAVBoy3bSOm3mDsaO3z6sbVhleR1R7Pee0iv vaAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=ur8jCYAx; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-111384-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111384-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jl11-20020ad45e8b000000b00696160339bbsi1852557qvb.551.2024.03.22.04.53.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 04:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111384-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=ur8jCYAx; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-111384-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111384-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 641B71C21ACB for ; Fri, 22 Mar 2024 11:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 985443FE4E; Fri, 22 Mar 2024 11:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="ur8jCYAx" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDE493FB1F for ; Fri, 22 Mar 2024 11:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711108363; cv=none; b=TwRjbD2OBeHOi2DGwxngaNWt24lrtP2xw0ztsd5uxe6j1nxoI7UyQox6rmcM6G/Ma3jfVsAQD2f7b/080o1hXQDxstk+BtUfH89uXMP6z+ujTSxq56N/V65mY6IuTeUpyYM+f7gxMmkTrECWUklugMEZgAKbGFPrxgP/gyrjfso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711108363; c=relaxed/simple; bh=x+a9e6Frx0VlBb4fwtx3sGzeXPW2PGanVCb6UGSYC30=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UJ72p3EetPj8IYerLajKa0h1BKOoDcyJbB0OLZySQAIuTWfdkc+ouilP7GmnX5zt+QAtRRQjug/Qtz5LO1G896G17EIJU4KvdhzMRqiRsikKoySrkKTwmZRMb712dNm9GSgfNah6V3Bcu5exXqV+XUHfTs6GOj2AvBW768LnwxU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=ur8jCYAx; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d68cf90ec4so33904701fa.1 for ; Fri, 22 Mar 2024 04:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1711108360; x=1711713160; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hVWFUDwpLHRWKDYEaq1Gc8i1EAEVOWiexCNmJxdcxRk=; b=ur8jCYAx2yLsvFWywcV8HOlgN7UrRzXgONknLA60UdcW1j6X3pkVAK9rt96aOVQHIk EowLG+h1vT/ysD77+Ale4zyHM6NCeEtPdq6Oyl49TmyD7TdkDsg3dTEcrHNa6S3Z8sWd 7w+VfoNG4N7AbOAAiSaNwH0uwazh1fGQJycwLhV5RZ0fMDORjAZ8BNk5ZV3yO2Akv+sL tlwInav+rH1WY6Q8tzuZMhopPRZGiJwghgR09as5xH5lAsj4auONK0uFRRMKoKn+yUKl WOkomPl7gTjf92SuDFh9XYZ6tcImsWCqZYb7u7aSH4RvdRpUTftIapD0MxWs8S8EZ7ak COMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711108360; x=1711713160; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hVWFUDwpLHRWKDYEaq1Gc8i1EAEVOWiexCNmJxdcxRk=; b=F/SamgICVFt3nLBofg2qfQx8dXAP5al7TuDmBevEWJ1v4ICBxVY4VKGFzP1B9VKTHM 6BFSywBJWmo9lqn5bmSvX3t2i+vngJHwdkQSA5dg3/APtY3A3NxWbi0yHyv6DocO7xm1 n2YjtMuAvssVQAk+CXqKD9KdMxhSEzBZh8uEyDO13eiuzQykj2323tAgrxoIwrK1VbHZ yLtpvbUvsqmDeXFqCpC0hDqR3R7LasfXl6/VzGIX+MCqqKdtB8rL2bM0aI/BzJqtBsF5 pPBIwhv3vkRJT3s7fCouTUgKLyrxvwHuSCY+cz1d83IX/YZsDEaPLPoXunD+6to2W3Tv 5AVg== X-Forwarded-Encrypted: i=1; AJvYcCVyGtl6kFJxEyAFmgiDuXsQ3KMPW+GgoJtz2sSCuNySmGBllOe0pUEnzVFTZASZYZZ6RWLvm3UD3m/An36ybEtBQR8OhXXJAwXk+Nq+ X-Gm-Message-State: AOJu0Yydxx+IJsqXg990dwuAKRfJudVCa2+qCc0Z0KDT5VgUo+U+9GHz 0wRhikzgTlBCeFydfDN1wd4EmYHZaQGQT5uj93Pf34sP3VKbsyRTcyVzrw2Ew9ebPRHwLy4r7ea yTx5NOYxXvvJv/CKLgOi+DRbm5fAn9TFEhMeXmQ== X-Received: by 2002:a2e:9056:0:b0:2d4:76d6:e9c9 with SMTP id n22-20020a2e9056000000b002d476d6e9c9mr1542931ljg.52.1711108360010; Fri, 22 Mar 2024 04:52:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240322090209.13384-1-brgl@bgdev.pl> <20240322111835.GA24228@rigel> In-Reply-To: <20240322111835.GA24228@rigel> From: Bartosz Golaszewski Date: Fri, 22 Mar 2024 12:52:29 +0100 Message-ID: Subject: Re: [PATCH v2] gpio: cdev: sanitize the label before requesting the interrupt To: Kent Gibson Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Dobriyan , stable@vger.kernel.org, Stefan Wahren , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 22, 2024 at 12:18=E2=80=AFPM Kent Gibson = wrote: > > On Fri, Mar 22, 2024 at 10:02:08AM +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > @@ -2198,12 +2216,18 @@ static int lineevent_create(struct gpio_device = *gdev, void __user *ip) > > if (ret) > > goto out_free_le; > > > > + label =3D make_irq_label(le->label); > > + if (!label) { > > + ret =3D -ENOMEM; > > + goto out_free_le; > > + } > > + > > /* Request a thread to read the events */ > > ret =3D request_threaded_irq(irq, > > lineevent_irq_handler, > > lineevent_irq_thread, > > irqflags, > > - le->label, > > + label, > > le); > > if (ret) > > goto out_free_le; > > Leaks label if the request_threaded_irq() fails. > Ah, dammit, I didn't catch the fact that irq_free() will not return the label address if the request failed. Nice catch. Bart