From patchwork Thu Aug 19 13:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgia Garcia X-Patchwork-Id: 1518677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=SQujHZSb; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gr5F51Rbbz9t18; Thu, 19 Aug 2021 23:28:25 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mGi5l-00036q-0h; Thu, 19 Aug 2021 13:28:21 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mGi5e-00035r-UM for kernel-team@lists.ubuntu.com; Thu, 19 Aug 2021 13:28:14 +0000 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id B87EE3F22D for ; Thu, 19 Aug 2021 13:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1629379694; bh=20UFXAVOjvOJ790k4TEPNxWMsOZiG2Ir9y/OfsxUsRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SQujHZSbIx6SRa4JmRUERPUDUtdjQyNmt9lJlydI37iAcqcIUJawG6+eqTbT9Ap0S IBJfGbW2w/US9BjD8LHX1uv1SzaxWIl55/oDqFrsB0o72tqjgWhNGbwbBlIM44NOV0 zG39vtFAv9TQ1C1d4OLaI85SuVhy+4ix9e9gQ7z+lrgCBamSnObQJHn/vq856QrF0G m2DTal7nTILF/y7L2CTySJvsRMVUm4pSP7KKNk1x0J7m8xgpZMAwvp+cp0SFUTUGyr AZpzEzSD2qgh0FJXgnDSoAi/3yYy9lYSAdRZO6zItLMRKIT8Plcua0zbOdWD/uxzuM FbdUQmdkJrmpw== Received: by mail-ej1-f69.google.com with SMTP id r21-20020a1709067055b02904be5f536463so2266980ejj.0 for ; Thu, 19 Aug 2021 06:28:14 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=20UFXAVOjvOJ790k4TEPNxWMsOZiG2Ir9y/OfsxUsRg=; b=T39202KUf38ZIIFhIgOhRfHYBMJfvytu42aTz9XyXCtUlfp5cRkegFRDxkaqBQ341x wbWMQ7WdeMmGcSqHUDUZOK2D8Z6/T2ntdEjzmeu1HQWwCAcePoP1Nx0yaOVV4XovaR4a uMkdLs7mIjrvtFKcTjYvgLR7UUuw6RTpzxiFj0sWndTnTidBxPLEbXVdALE+h3KF1fNc tfkHNLuLkmJ9YLSpJgN4tzoHSdayP8ryjy257a/blotsN4PO+Zlhq7TqFXoOet5LePuq VJuMvohYgIoMC2By4KH3BG6/jARH3ALtdt0bJItanva9GzpEAMB8VhMCBPjEhCcVNA6z PCXQ== X-Gm-Message-State: AOAM5310CJ2weKbug1tsbrBO1+a+WTNjOAfg74wz1sJOzHfHxhQH2NxO VSbMxGWMczOD2vXlpSgVRV5ar7cX/kH2I+l2y1gUlCvNh1pehj13pn1a5JtKYDL3729o1Jh4OeZ 197Lag81X6qwXJuSLeWxpZmsNEpH9XWfXvF1mws14oQ== X-Received: by 2002:a17:906:4fd6:: with SMTP id i22mr15895636ejw.92.1629379694279; Thu, 19 Aug 2021 06:28:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnoUi8mmnUSWdEE3RnXE6yz0Cs+cw5jtG4hzFpP3o1TIbsOedCC1Qin7e3ulnRqDFzVZxlsg== X-Received: by 2002:a17:906:4fd6:: with SMTP id i22mr15895620ejw.92.1629379694144; Thu, 19 Aug 2021 06:28:14 -0700 (PDT) Received: from localhost ([2001:67c:1562:8007::aac:4557]) by smtp.gmail.com with ESMTPSA id v8sm1654867edc.2.2021.08.19.06.28.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 06:28:13 -0700 (PDT) From: Georgia Garcia To: kernel-team@lists.ubuntu.com Subject: [SRU][PATCH v4 B 1/2] security/apparmor/label.c: Clean code by removing redundant instructions Date: Thu, 19 Aug 2021 10:28:02 -0300 Message-Id: <20210819132803.9481-2-georgia.garcia@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819132803.9481-1-georgia.garcia@canonical.com> References: <20210819132803.9481-1-georgia.garcia@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mateusz Nosek BugLink: https://bugs.launchpad.net/bugs/1939915 Previously 'label->proxy->label' value checking and conditional reassigning were done twice in the same function. The second one is redundant and can be removed. Signed-off-by: Mateusz Nosek Signed-off-by: John Johansen (cherry picked from commit c84b80cd41e05395655459ecc652fa5ee05c257e) Signed-off-by: Georgia Garcia --- security/apparmor/label.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/security/apparmor/label.c b/security/apparmor/label.c index 9171cd8ec032..c276d3035813 100644 --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -315,8 +315,6 @@ int aa_vec_unique(struct aa_profile **vec, int n, int flags) static void label_destroy(struct aa_label *label) { - struct aa_label *tmp; - AA_BUG(!label); if (!label_isprofile(label)) { @@ -337,10 +335,6 @@ static void label_destroy(struct aa_label *label) aa_free_secid(label->secid); - tmp = rcu_dereference_protected(label->proxy->label, true); - if (tmp == label) - rcu_assign_pointer(label->proxy->label, NULL); - aa_put_proxy(label->proxy); label->proxy = (struct aa_proxy *) PROXY_POISON + 1; }