Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2974896ybk; Tue, 12 May 2020 12:45:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYxfTfMf0y6ItvWOBzNxqd3NtNfTv5ULS/Q80XJfgYzajq00htveMlyOueKmKGWx3ajPbM X-Received: by 2002:a50:c091:: with SMTP id k17mr8466553edf.106.1589312742465; Tue, 12 May 2020 12:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589312742; cv=none; d=google.com; s=arc-20160816; b=bBYg0g+NlGC1ITZnTeZwKZSrQlrNQxYkrz9WTWzMNMOEy3pElsJoKRy58Lie2KHYTI LHHHVpReGcSE/Qt+R2pP2mE6+ULDOf3rFkGsx6kQktOwGeapnRRAj4ynZN8xui6TIdvP HFYBy/ppQh0NOHAEnt+QeCMaNuYxA7KPqdc9OUYjdYaUs8wDEndkwDqccvLeUjXaH9+k jGrZmntpNllxLEt/iIns62o9xvhzOaTKbC8oY+JHTRTUZSf1HxWMY9tx7uMKLTLz0Q4r vIiRlIHbn5aHYsG6bFSo+Cr2CXbZFY2chFGUGS20qaOnS5SbMMH8JSZYGrlpoapaFztv wxsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pbleye/tcK1271rZA5Esc6+UJ+CAeRD5kNKc6nTEvCM=; b=PF9Z+y98hZBBelT7MJ66ds8c+NmaGdjh1YEpCuGxr9WBcsADq+U7pWqwhWHEJwqKBA J5vjn8JPumRWR9FjBeM1W71RikJ9pFOqV4KWFJTExRTWT7ZoGFdow0uPoPWQTaQKO+qa LrCfJ9qFXNQB8f84VDkYLTXkO6br6fKoQz4UbCnunB7/xt8VLF0p+xb5sCY/6aWqVYsz d+5k9DU7slvdIKHF93OW7zFkmpzW8QYy75vqGjD1ornt/ofWXSnfRWwsf//DrDIUgcKL axA0SzFVfShV1p8s7Yu2Qc8G12AAB7aAueOnDeW8aLoAsFq1QL4fDwmW4LU8WHSpkRkN 4sYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hgWwoDIu; 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 h4si9284092edn.445.2020.05.12.12.45.00; Tue, 12 May 2020 12:45:42 -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=@linuxfoundation.org header.s=google header.b=hgWwoDIu; 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 S1730821AbgELTnK (ORCPT + 99 others); Tue, 12 May 2020 15:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbgELTnJ (ORCPT ); Tue, 12 May 2020 15:43:09 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64EDDC061A0E for ; Tue, 12 May 2020 12:43:09 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id f4so9047281iov.11 for ; Tue, 12 May 2020 12:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pbleye/tcK1271rZA5Esc6+UJ+CAeRD5kNKc6nTEvCM=; b=hgWwoDIuKQrPHvpd9vLJmSCo/BP1E7oj+ZV1RVrMJ5fHVPk0RWubYI8cOU+XZuaQb3 6RZdoAFgWjKDU/G6vOFiDZlblDPxZM7fyi0h9Qn5bogfcGcCxEXvyvxfd6Gle2aD71nE 6n6FvGwme4j81i5XsD4F16we04NDcPjPT3cl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pbleye/tcK1271rZA5Esc6+UJ+CAeRD5kNKc6nTEvCM=; b=XcgT8qTj/ocKoTNxut1lgsdkM1zI5H5aZIzJxM26IS/P04aOkDNnjTRUFa41RX7YaP J2cI9KTVUG7KgW5RfVtwYlxaPfwsskiL1gHZRa91D00L07wT5aj/6cRAxt4cavGdpL7w 9OoKcr6DmEXloHxCO8HHmN4KXWygXD2PIiHzptw/AYR30VWfg9f9ygjZ999AT809J55o QVoXa7vINfvdzIR99Gy8VRwZxmsQdSmZ37d82F2IyI8Pvcg2ZuBMOxsy/Bn6iQG8xkOe oOs2ePmoReXa27WtursvN6j1HmJ7BZDaMcTAOCAwNqicu/mt4RV6RcUpwvQijBD4k65G zW9A== X-Gm-Message-State: AGi0PubqZiASAKpGN6S3kF8+fKN+JtWirrlf38Klc2KruQWE+kbPZfjw p15PnTillHdLBt5UHyu6bwDPWA== X-Received: by 2002:a6b:e517:: with SMTP id y23mr816204ioc.60.1589312588662; Tue, 12 May 2020 12:43:08 -0700 (PDT) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id f5sm6177781iok.4.2020.05.12.12.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 12:43:08 -0700 (PDT) From: Shuah Khan To: viro@zeniv.linux.org.uk, axboe@kernel.dk, zohar@linux.vnet.ibm.com, mcgrof@kernel.org, keescook@chromium.org Cc: Shuah Khan , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] fs: avoid fdput() after failed fdget() Date: Tue, 12 May 2020 13:43:03 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While debugging an unrelated problem, I noticed these two cases fdput() is called after failed fdget() while reviewing at all the fdget() and fdput() paths in the kernel. Changes since v1: Patch 1: Changed to address review comments to refine the code for improved readability in addition to the change to avoid fdput() on failed fdget() Patch 2: No change to v1. Including it in the series to keep the patches together. Shuah Khan (2): fs: avoid fdput() after failed fdget() in ksys_sync_file_range() fs: avoid fdput() after failed fdget() in kernel_read_file_from_fd() fs/exec.c | 2 +- fs/sync.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) -- 2.25.1