From patchwork Fri Mar 15 14:33:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2E3C1708 for ; Fri, 15 Mar 2019 14:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC7202AA5E for ; Fri, 15 Mar 2019 14:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0C172AA60; Fri, 15 Mar 2019 14:33:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DA262AA4F for ; Fri, 15 Mar 2019 14:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729284AbfCOOd1 (ORCPT ); Fri, 15 Mar 2019 10:33:27 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44018 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729241AbfCOOd1 (ORCPT ); Fri, 15 Mar 2019 10:33:27 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntk-0004kR-RY; Fri, 15 Mar 2019 16:33:25 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Fri, 15 Mar 2019 16:33:13 +0200 Message-Id: <20190315143318.4714-2-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 1/6] backport: add v5.* to the Makefile Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho Now that 4.21 became 5.0, we need to update the Makefile accordingly. Stop looking at 4.19 for the 4.* series and add 5.*. Signed-off-by: Luca Coelho --- backport/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backport/Makefile b/backport/Makefile index 0fd4cdb2f322..ee7df4ba29ce 100644 --- a/backport/Makefile +++ b/backport/Makefile @@ -85,12 +85,13 @@ mrproper: done \ ) > Kconfig.kernel ;\ kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \ - sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ + sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ test "$$kver" != "" || echo "Kernel version parse failed!" ;\ test "$$kver" != "" ;\ kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\ - kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\ + kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\ + kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\ print=0 ;\ for v in $$kvers ; do \ if [ "$$print" = "1" ] ; then \ From patchwork Fri Mar 15 14:33:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C61A14DE for ; Fri, 15 Mar 2019 14:33:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 451952AA4F for ; Fri, 15 Mar 2019 14:33:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 393F12AA5E; Fri, 15 Mar 2019 14:33:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D19D12AA4F for ; Fri, 15 Mar 2019 14:33:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729241AbfCOOd1 (ORCPT ); Fri, 15 Mar 2019 10:33:27 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44024 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729283AbfCOOd1 (ORCPT ); Fri, 15 Mar 2019 10:33:27 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntl-0004kR-I1; Fri, 15 Mar 2019 16:33:25 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Fri, 15 Mar 2019 16:33:14 +0200 Message-Id: <20190315143318.4714-3-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 2/6] backports: update iwlwifi pci device removal patch for v5.0 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho The code surrounding the #ifdef we add has changed. Update the patch accordingly. Signed-off-by: Luca Coelho --- patches/0085-iwlwifi-pci-device-removal.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/0085-iwlwifi-pci-device-removal.patch b/patches/0085-iwlwifi-pci-device-removal.patch index 84fa7f9264a8..97a904f6365f 100644 --- a/patches/0085-iwlwifi-pci-device-removal.patch +++ b/patches/0085-iwlwifi-pci-device-removal.patch @@ -1,18 +1,18 @@ diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -index cc8c53dc0ab6..68296b65a680 100644 +index f74281508197..3b11bd68f261 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c -@@ -1968,6 +1968,9 @@ static void iwl_trans_pcie_removal_wk(st +@@ -1964,6 +1964,9 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk) struct iwl_trans_pcie_removal *removal = container_of(wk, struct iwl_trans_pcie_removal, work); struct pci_dev *pdev = removal->pdev; +#if LINUX_VERSION_IS_LESS(3,14,0) + dev_err(&pdev->dev, "Device gone - can't remove on old kernels.\n"); +#else - char *prop[] = {"EVENT=INACCESSIBLE", NULL}; + static char *prop[] = {"EVENT=INACCESSIBLE", NULL}; dev_err(&pdev->dev, "Device gone - attempting removal\n"); -@@ -1976,6 +1979,7 @@ static void iwl_trans_pcie_removal_wk(st +@@ -1972,6 +1975,7 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk) pci_dev_put(pdev); pci_stop_and_remove_bus_device(pdev); pci_unlock_rescan_remove(); From patchwork Fri Mar 15 14:33:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A03D14DE for ; Fri, 15 Mar 2019 14:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 032CF2AA4F for ; Fri, 15 Mar 2019 14:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBE0D2AA5E; Fri, 15 Mar 2019 14:33:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7E912AA4F for ; Fri, 15 Mar 2019 14:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729286AbfCOOd2 (ORCPT ); Fri, 15 Mar 2019 10:33:28 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44030 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729221AbfCOOd2 (ORCPT ); Fri, 15 Mar 2019 10:33:28 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntm-0004kR-5m; Fri, 15 Mar 2019 16:33:26 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Fri, 15 Mar 2019 16:33:15 +0200 Message-Id: <20190315143318.4714-4-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 3/6] backport: add atomic_fetch_add_unless() Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho The iwlwifi driver now needs this function. Backport it. Signed-off-by: Luca Coelho --- backport/backport-include/linux/atomic.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backport/backport-include/linux/atomic.h b/backport/backport-include/linux/atomic.h index b4dd2e1d34f0..9ceb586e864a 100644 --- a/backport/backport-include/linux/atomic.h +++ b/backport/backport-include/linux/atomic.h @@ -51,4 +51,13 @@ #endif /* atomic_try_cmpxchg_acquire */ +#if LINUX_VERSION_IS_LESS(4,19,0) +#ifndef atomic_fetch_add_unless +static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) +{ + return __atomic_add_unless(v, a, u); +} +#endif +#endif + #endif /* __BP_ATOMIC_H */ From patchwork Fri Mar 15 14:33:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CC7F14DE for ; Fri, 15 Mar 2019 14:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54FC52AA4F for ; Fri, 15 Mar 2019 14:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49AF52AA5E; Fri, 15 Mar 2019 14:33:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DF412AA4F for ; Fri, 15 Mar 2019 14:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729221AbfCOOd2 (ORCPT ); Fri, 15 Mar 2019 10:33:28 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44036 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729283AbfCOOd2 (ORCPT ); Fri, 15 Mar 2019 10:33:28 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntm-0004kR-Pi; Fri, 15 Mar 2019 16:33:27 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Fri, 15 Mar 2019 16:33:16 +0200 Message-Id: <20190315143318.4714-5-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 4/6] backport: add include ftrace_event.h back to backport-4.0.c Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho At least one function, namely ftrace_print_array_seq(), still needs the ftrace_event.h header file, otherwise sparse may warning that it is declared as non-static without pre-declaration. Signed-off-by: Luca Coelho --- backport/compat/backport-4.0.c | 1 + 1 file changed, 1 insertion(+) diff --git a/backport/compat/backport-4.0.c b/backport/compat/backport-4.0.c index 84a4c6bf27b7..fbe0ddbc3bdd 100644 --- a/backport/compat/backport-4.0.c +++ b/backport/compat/backport-4.0.c @@ -15,6 +15,7 @@ #include #include #include +#include #include /** From patchwork Fri Mar 15 14:33:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E1D215AC for ; Fri, 15 Mar 2019 14:33:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A1A2AA4F for ; Fri, 15 Mar 2019 14:33:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C6FB2AA5E; Fri, 15 Mar 2019 14:33:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24FAC2AA4F for ; Fri, 15 Mar 2019 14:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729287AbfCOOda (ORCPT ); Fri, 15 Mar 2019 10:33:30 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44048 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729283AbfCOOda (ORCPT ); Fri, 15 Mar 2019 10:33:30 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntn-0004kR-FU; Fri, 15 Mar 2019 16:33:29 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Luca Coelho Date: Fri, 15 Mar 2019 16:33:17 +0200 Message-Id: <20190315143318.4714-6-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 5/6] backport: fix handling of nospec.h for 4.15.0 and 4.15.1 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luca Coelho The patch that introduces nospec.h was cherry-picked for 4.15 only in 4.15.2, so we need to adjust the ifdefs of our stub. Signed-off-by: Luca Coelho --- backport/backport-include/linux/nospec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backport/backport-include/linux/nospec.h b/backport/backport-include/linux/nospec.h index 50cf46737cbb..07647241f78f 100644 --- a/backport/backport-include/linux/nospec.h +++ b/backport/backport-include/linux/nospec.h @@ -1,7 +1,8 @@ #ifndef _BACKPORT_LINUX_NOSPEC_H #define _BACKPORT_LINUX_NOSPEC_H -#if LINUX_VERSION_IS_GEQ(4,14,18) || \ +#if LINUX_VERSION_IS_GEQ(4,15,2) || \ + LINUX_VERSION_IN_RANGE(4,14,18, 4,15,0) || \ LINUX_VERSION_IN_RANGE(4,9,81, 4,10,0) || \ LINUX_VERSION_IN_RANGE(4,4,118, 4,5,0) #include_next From patchwork Fri Mar 15 14:33:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 10854883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51BA515AC for ; Fri, 15 Mar 2019 14:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A1972AA4F for ; Fri, 15 Mar 2019 14:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ED8F2AA5E; Fri, 15 Mar 2019 14:33:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C464E2AA4F for ; Fri, 15 Mar 2019 14:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729288AbfCOOdc (ORCPT ); Fri, 15 Mar 2019 10:33:32 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:44058 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729283AbfCOOdc (ORCPT ); Fri, 15 Mar 2019 10:33:32 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.91) (envelope-from ) id 1h4ntp-0004kR-An; Fri, 15 Mar 2019 16:33:30 +0200 From: Luca Coelho To: backports@vger.kernel.org Cc: Johannes Berg , Luca Coelho Date: Fri, 15 Mar 2019 16:33:18 +0200 Message-Id: <20190315143318.4714-7-luca@coelho.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315143318.4714-1-luca@coelho.fi> References: <20190315143318.4714-1-luca@coelho.fi> MIME-Version: 1.0 Subject: [PATCH 6/6] backports: genetlink: avoid NULL dereference Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Berg If we fail to allocate extack, we fall back to the code path that tries to send an error *with* extack, but that will access our extack pointer. It also doesn't make sense, so just return an error back to netlink immediately and let it handle sending the error message to userspace. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho --- backport/compat/backport-genetlink.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backport/compat/backport-genetlink.c b/backport/compat/backport-genetlink.c index 71bf45adf88d..885f17568333 100644 --- a/backport/compat/backport-genetlink.c +++ b/backport/compat/backport-genetlink.c @@ -157,12 +157,10 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops, #if LINUX_VERSION_IS_LESS(4,12,0) struct netlink_ext_ack *extack = kzalloc(sizeof(*extack), GFP_KERNEL); - __bp_genl_info_userhdr_set(info, extack); + if (!extack) + return -ENOMEM; - if (!extack) { - err = -ENOMEM; - goto err; - } + __bp_genl_info_userhdr_set(info, extack); extack->__bp_doit = ops->doit; #else @@ -175,7 +173,6 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops, err = family->pre_doit(ops, skb, info); #if LINUX_VERSION_IS_LESS(4,12,0) -err: if (err) { /* signal to do nothing */ extack->__bp_doit = NULL;