[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14314f54-57fa-fa89-ce4c-ce79116d3d80@linuxfoundation.org>
Date: Mon, 4 Oct 2021 14:34:50 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: Eric Dumazet <edumazet@...gle.com>,
Naresh Kamboju <naresh.kamboju@...aro.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
open list <linux-kernel@...r.kernel.org>,
Shuah Khan <shuah@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>, patches@...nelci.org,
lkft-triage@...ts.linaro.org, Jon Hunter <jonathanh@...dia.com>,
linux-stable <stable@...r.kernel.org>,
Pavel Machek <pavel@...x.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Guenter Roeck <linux@...ck-us.net>,
Netdev <netdev@...r.kernel.org>, Jann Horn <jannh@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Luiz Augusto von Dentz <luiz.von.dentz@...el.com>,
Marcel Holtmann <marcel@...tmann.org>,
"David S. Miller" <davem@...emloft.net>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 4.19 00/95] 4.19.209-rc1 review
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
>> <naresh.kamboju@...aro.org> wrote:
>>>
>>> On Mon, 4 Oct 2021 at 18:32, Greg Kroah-Hartman
>>> <gregkh@...uxfoundation.org> 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 <skhan@...uxfoundation.org>
-----------------------------------------------------------------------
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
Powered by blists - more mailing lists