Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3919312rwi; Sat, 22 Oct 2022 02:12:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77kp2ARyTd4C1SrbZZNbvUtVrNTWZ4dqNsIBNvU+4u5X6wAryNxBNAYtqQyjVmZmksWHU8 X-Received: by 2002:a17:90a:a415:b0:20a:f813:83a3 with SMTP id y21-20020a17090aa41500b0020af81383a3mr27496204pjp.238.1666429943703; Sat, 22 Oct 2022 02:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429943; cv=none; d=google.com; s=arc-20160816; b=NI/1R1o5vQDAIliGoClZbqVdEusDSqmZok1j6/FDsGg5p3bRgvlSoh4XwbRt21g9Mt tzjpH6Ru5imRe2my4FkatyD4qUsbkTNItdwpUL9z9U7tDdW5otIQhRThTrxfiy1Lmok5 bd3rG72C3StnF9eRSlkYd1ok2+rQ2WOI2Hl1Z3/NwjuGoa8MXZloiyd5uk5d9NzXHr44 AuAjGcgaZWKbAUELZDd8J7R/A0OxLbv0Sm4iPJi/UxPGafO6+MRhuYNocrNnOVZA9K6L cTcJUaG7M4MaiK4zg7kTOVXDD8QouZ7L/Q4UWENgYxW25pToz57QiX5O6Qa/ktnBoSBs I99A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0UOl1aiHxfbl5y0qLe8snXEwurKvOUmX+LG+chHolj0=; b=yq8uTDGZJnE5YLUIXbkO1SCBR5qIhQCsH3dgPkKWu91UdYvW9Vlb05nrbIgXsjFjTw zpRNmireHQy3h6g8EUaj7AoPTtPJFnK6FA2bRLif0HkKLa3c0YWGX1LWzq9ICvxI8YHF qJ7fKFO+jELg7LC9o0CLDj7uNnCAGIG4NkhrT43UAhRBV1xTOCvnuQIbYBNk8yzabtaF K6okoBZYh/7hvLD3emSUMnxyHHeEaAlxRjVnRGVMrK2q3FVuYVXDBTLOHgsRqhLE6exh nPyAMtjwQiLQF2xvdwt0yTGtGKYlk0cCfXuWZf4C+UUM5bQsSIdlzOCU/BpSlHZGTnr7 4bKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gPW3MBKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902d3c600b001783af487d1si25333800plb.533.2022.10.22.02.12.12; Sat, 22 Oct 2022 02:12:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gPW3MBKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234662AbiJVImG (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234499AbiJVIiu (ORCPT ); Sat, 22 Oct 2022 04:38:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A7B1A7A22; Sat, 22 Oct 2022 01:05:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A681860B6B; Sat, 22 Oct 2022 07:52:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7395C433D6; Sat, 22 Oct 2022 07:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425155; bh=Wmphf3AsPlAzcTCjF/2Rty8KRXokQysKlrzKnN12nkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPW3MBKAiTTCiaR+/RAiRDK3VisNuvgnzdSOv2ehBVcHoBHm62rfUCDYFdArZhwNH vzi6/YbS6/KJC6iXwT80JhmoRaKOpm7uXwFhK0SAtRpj9wY6fveEPejdTl56xhAi9H BeTHFVXOWZgCLhTVKZ7MqoGtvlcKJiD+M4DTZstw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Barrat , Hangyu Hua , Sasha Levin Subject: [PATCH 5.19 409/717] misc: ocxl: fix possible refcount leak in afu_ioctl() Date: Sat, 22 Oct 2022 09:24:48 +0200 Message-Id: <20221022072516.153083178@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangyu Hua [ Upstream commit c3b69ba5114c860d730870c03ab4ee45276e5e35 ] eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Acked-by: Frederic Barrat Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220824082600.36159-1-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 6777c419a8da..d46dba2df5a1 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd, if (IS_ERR(ev_ctx)) return PTR_ERR(ev_ctx); rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx); + if (rc) + eventfd_ctx_put(ev_ctx); break; case OCXL_IOCTL_GET_METADATA: -- 2.35.1