From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FF4AC433E0 for ; Mon, 1 Feb 2021 18:58:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEF6364DDF for ; Mon, 1 Feb 2021 18:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbhBAS6A (ORCPT ); Mon, 1 Feb 2021 13:58:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbhBAS56 (ORCPT ); Mon, 1 Feb 2021 13:57:58 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7CCDC061573 for ; Mon, 1 Feb 2021 10:57:17 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id d13so18538393ioy.4 for ; Mon, 01 Feb 2021 10:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Jsv3vyZa66t7tee4Ufeuta3p2dV9PPOMykNPk31Fui0=; b=wQ2QRoCO68p2wvluwHKbXJ6kLWJoj6ZH7pf/zK/jkpEgm5yfvk+ZAwQG7cpB4/Bm0A b00A7EpJFWe8gVjM+szFwdmoO2uaQDqT0jX+Zobj12gzdGangcguN7lm6V58g6GsOi4g Zj0WtG1ZYgKc7HtP93da+85GQPQCHx8GW4BNWJodBBL9yu6TuDzT1rfSiTE8/p9uXExg UdKYR5ahJ4h4mrkSa9rRYpJSBU6XC1OGcuazmbkdRjB2F19240mnM++fbHiQHmDAgcQT lN7cT/15dbzYAcC1OR6wQJFQC+71Fdi4oHcmRxwf8wIlmtY9/0iEBzPl9uaOHllPjMId TTzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Jsv3vyZa66t7tee4Ufeuta3p2dV9PPOMykNPk31Fui0=; b=GFaXw0aHyYfJps4/WJjWYYFrmdV2+gyrvQYZGLLsV7Xt5kHe9nqL6dP78gHr7qgKNI CUI/FTIA1tEee4assIGs3WvhHwT/Tif6qtSNHBzQkoSFRHo6do2JiKA3gaPhR9R8Nseb yDPCNbshlLOb95j/e0IzivS2xRnecyxsI5ft9M4wkgHppV26baCAiE7i18wRFLu5nzW8 Qfr4dM2wRaqw/IUyOLfIBr/8A8URedi0ayIn0vt287VUUaNNm+Zqnq+YMcjy71AFYERy zJAuijePVHC+rc8tYYJWlyrQ/fxifUet5c9SNw4ynP8IB7hhfrEXAefV4xxczgpNsic0 gg0g== X-Gm-Message-State: AOAM531EOzpPNBuuHIHJheaDv5Auvoyo7waUHNa9o0c6xgPp5ftI2+M8 EnWpcRaG9c/bAiDMgSbxeIb42bfuDWXUkxp8 X-Google-Smtp-Source: ABdhPJwggjUj4DBGEfKTj9stcq2mP3nHEIL5MQZGiiZyPsO/XHyrxXdLCFhNcnmwmidHVkecucwp3Q== X-Received: by 2002:a05:6638:42:: with SMTP id a2mr6674489jap.99.1612205837221; Mon, 01 Feb 2021 10:57:17 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id n7sm860569ile.12.2021.02.01.10.57.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Feb 2021 10:57:16 -0800 (PST) Subject: Re: [PATCH] io_uring: Fix NULL dereference in error in io_sqe_files_register() To: Dan Carpenter , Bijan Mottahedeh Cc: Pavel Begunkov , io-uring@vger.kernel.org, kernel-janitors@vger.kernel.org References: From: Jens Axboe Message-ID: <76165fad-a61a-a59c-6b6f-d8ae151bed86@kernel.dk> Date: Mon, 1 Feb 2021 11:57:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 2/1/21 5:23 AM, Dan Carpenter wrote: > If we hit a "goto out_free;" before the "ctx->file_data" pointer has > been assigned then it leads to a NULL derefence when we call: > > free_fixed_rsrc_data(ctx->file_data); > > We can fix this by moving the assignment earlier. Applied, thanks Dan. -- Jens Axboe