From patchwork Wed Sep 16 05:51:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Gorenko X-Patchwork-Id: 11778957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF48759D for ; Wed, 16 Sep 2020 06:10:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CEB9220809 for ; Wed, 16 Sep 2020 06:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726132AbgIPGKj (ORCPT ); Wed, 16 Sep 2020 02:10:39 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:59554 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726128AbgIPGKj (ORCPT ); Wed, 16 Sep 2020 02:10:39 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from sergeygo@nvidia.com) with SMTP; 16 Sep 2020 09:10:33 +0300 Received: from rsws38.mtr.labs.mlnx (rsws38.mtr.labs.mlnx [10.209.40.117]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 08G6AXrd017431; Wed, 16 Sep 2020 09:10:33 +0300 From: Sergey Gorenko To: linux-rdma@vger.kernel.org Cc: Sergey Gorenko , Max Gurtovoy , Bart Van Assche Subject: [PATCH v1] srp_daemon: Avoid extra permissions for the lock file Date: Wed, 16 Sep 2020 05:51:13 +0000 Message-Id: <20200916055113.15151-1-sergeygo@nvidia.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org There is no need to create a world-writable lock file. It's enough to have an RW permission for the file owner only. Fixes: ee138ce1e40d ("Cause srp_daemon launch to fail if another srp_daemon is already working on the same HCA port.") Signed-off-by: Sergey Gorenko Reviewed-by: Max Gurtovoy Reviewed-by: Bart Van Assche --- Changelog: v1: Add the fixes line. --- srp_daemon/srp_daemon.c | 1 - 1 file changed, 1 deletion(-) diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c index f14d9f56c9f2..fcf94537cebb 100644 --- a/srp_daemon/srp_daemon.c +++ b/srp_daemon/srp_daemon.c @@ -142,7 +142,6 @@ static int check_process_uniqueness(struct config_t *conf) return -1; } - fchmod(fd, S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH); if (0 != lockf(fd, F_TLOCK, 0)) { pr_err("failed to lock %s (errno: %d). possibly another " "srp_daemon is locking it\n", path, errno);