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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AABCC433F5 for ; Mon, 4 Oct 2021 20:34:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17DBD613D2 for ; Mon, 4 Oct 2021 20:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233934AbhJDUgn (ORCPT ); Mon, 4 Oct 2021 16:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235526AbhJDUgl (ORCPT ); Mon, 4 Oct 2021 16:36:41 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E678C061749 for ; Mon, 4 Oct 2021 13:34:52 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id 5so9315445iov.9 for ; Mon, 04 Oct 2021 13:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=c0hwqs6p7Ru2CkxdNWAgix4idc1xYEonvtNVJOMJao0=; b=ROnqbH3ApfRdwm045GfASwtFIN3fGzOP1qpYXoFJg5LT+LODJlJbWho8fNVopL+bCY ONCasCj5CZNAQ3EU7x+6O5rVy/UMzIsPhB/EATs1fmaoX/vvhX7OKkG0RNqiEsXTM5+m S60uDyWm51GQX8xSA14uOeK3U8W0tnxuHejic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=c0hwqs6p7Ru2CkxdNWAgix4idc1xYEonvtNVJOMJao0=; b=SYGYV7mmtVWzvGtkn0AMNGr+ZOwv/M/TGABeo5kGWtDGN7My0VBL9XJV//wQpDUFcV l2G/tL9wrckqYcnAQVtUx1A/2V62aoLKyDY3+DPo0dvjdGEL0J58odkk4db1y6ZdbiHO Gum/Q2owMWORQYqM5i1sTLbcIE5RdNMStSvUH3SwmVL7tYJiqyT4EzsFI2RRlZmLt2NA mZiTQGVTPQ+xlyaFffrjdXM9cZrFBfpmF9FPDu9Jxj0a+D5Sbe9/Zwb7L9I9xGDP7THw erCXS4zzNEOaNfn49OcBHgXsPFxz8yT5QUq7Cl0DcrYvfszUMdKjdhHhmjeFLRM063to iHkg== X-Gm-Message-State: AOAM533nDgrA/1jA8FkbKvsZLN0PewzwULmcqHb16mK9bFBk8/OLBEIP 3I5oznZsarytlWIbt6kmF/xAsA== X-Google-Smtp-Source: ABdhPJzhtmZYb3L3kzexCvpg44/FmdXYXLLWs3+jHNagrFBcW0HT9/ky8nw9XMC3cdz0pWwN+yWxEg== X-Received: by 2002:a02:caac:: with SMTP id e12mr12873268jap.16.1633379691949; Mon, 04 Oct 2021 13:34:51 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id l3sm9697379ilq.48.2021.10.04.13.34.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Oct 2021 13:34:51 -0700 (PDT) Subject: Re: [PATCH 4.19 00/95] 4.19.209-rc1 review To: Eric Dumazet , Naresh Kamboju Cc: Greg Kroah-Hartman , open list , Shuah Khan , Florian Fainelli , patches@kernelci.org, lkft-triage@lists.linaro.org, Jon Hunter , linux-stable , Pavel Machek , Andrew Morton , Linus Torvalds , Guenter Roeck , Netdev , Jann Horn , "Eric W. Biederman" , Luiz Augusto von Dentz , Marcel Holtmann , "David S. Miller" , Shuah Khan References: <20211004125033.572932188@linuxfoundation.org> <576d46b9-644f-ece0-2cf0-8abbe8b85f4a@linuxfoundation.org> From: Shuah Khan Message-ID: <14314f54-57fa-fa89-ce4c-ce79116d3d80@linuxfoundation.org> Date: Mon, 4 Oct 2021 14:34:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <576d46b9-644f-ece0-2cf0-8abbe8b85f4a@linuxfoundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/4/21 1:49 PM, Shuah Khan wrote: > On 10/4/21 11:44 AM, Eric Dumazet wrote: >> On Mon, Oct 4, 2021 at 10:40 AM Naresh Kamboju >> wrote: >>> >>> On Mon, 4 Oct 2021 at 18:32, Greg Kroah-Hartman >>> wrote: >>>> >>>> This is the start of the stable review cycle for the 4.19.209 release. >>>> There are 95 patches in this series, all will be posted as a response >>>> to this one.  If anyone has any issues with these being applied, please >>>> let me know. >>>> >>>> Responses should be made by Wed, 06 Oct 2021 12:50:17 +0000. >>>> Anything received after that time might be too late. >>>> >>>> The whole patch series can be found in one patch at: >>>>          https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.209-rc1.gz >>>> or in the git tree and branch at: >>>>          git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y >>>> and the diffstat can be found below. >>>> >>>> thanks, >>>> >>>> greg k-h >>> >>> Regression found on arm, arm64, i386 and x86. >>> following kernel crash reported on stable-rc linux-4.19.y. >>> >> >> Stable teams should backport cred: allow get_cred() and put_cred() to >> be given NULL. >> >> f06bc03339ad4c1baa964a5f0606247ac1c3c50b >> >> Or they should have tweaked my patch before backporting it. >> > Seeing the same problem on my test system as well. > > Patch applied with fuzz. Didn't need any tweaks. Compiling now. > Will let you know soon. > With f06bc03339ad4c1baa964a5f0606247ac1c3c50b Compiled and booted on my test system. No dmesg regressions. Tested-by: Shuah Khan ----------------------------------------------------------------------- diff --git a/include/linux/cred.h b/include/linux/cred.h index 1dc351d8548b..4b081e4911c8 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -240,7 +240,7 @@ static inline struct cred *get_new_cred(struct cred *cred) * @cred: The credentials to reference * * Get a reference on the specified set of credentials. The caller must - * release the reference. + * release the reference. If %NULL is passed, it is returned with no action. * * This is used to deal with a committed set of credentials. Although the * pointer is const, this will temporarily discard the const and increment the @@ -251,6 +251,8 @@ static inline struct cred *get_new_cred(struct cred *cred) static inline const struct cred *get_cred(const struct cred *cred) { struct cred *nonconst_cred = (struct cred *) cred; + if (!cred) + return cred; validate_creds(cred); nonconst_cred->non_rcu = 0; return get_new_cred(nonconst_cred); @@ -261,7 +263,7 @@ static inline const struct cred *get_cred(const struct cred *cred) * @cred: The credentials to release * * Release a reference to a set of credentials, deleting them when the last ref - * is released. + * is released. If %NULL is passed, nothing is done. * * This takes a const pointer to a set of credentials because the credentials * on task_struct are attached by const pointers to prevent accidental @@ -271,9 +273,11 @@ static inline void put_cred(const struct cred *_cred) { struct cred *cred = (struct cred *) _cred; - validate_creds(cred); - if (atomic_dec_and_test(&(cred)->usage)) - __put_cred(cred); + if (cred) { + validate_creds(cred); + if (atomic_dec_and_test(&(cred)->usage)) + __put_cred(cred); + } } /** ----------------------------------------------------------------------- thanks, -- Shuah