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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65893C433ED for ; Sat, 3 Apr 2021 16:26:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D54B61263 for ; Sat, 3 Apr 2021 16:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236880AbhDCQ0R (ORCPT ); Sat, 3 Apr 2021 12:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236364AbhDCQ0P (ORCPT ); Sat, 3 Apr 2021 12:26:15 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCA5FC0613E6; Sat, 3 Apr 2021 09:26:12 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lSj65-0070RZ-Az; Sat, 03 Apr 2021 18:26:05 +0200 Message-ID: Subject: Re: [PATCH] net: netlink: fix error check in genl_family_rcv_msg_doit From: Johannes Berg To: Pavel Skripkin , "davem@davemloft.net" , "kuba@kernel.org" Cc: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Sat, 03 Apr 2021 18:26:04 +0200 In-Reply-To: <20210403151312.31796-1-paskripkin@gmail.com> References: <20210403151312.31796-1-paskripkin@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-04-03 at 15:13 +0000, Pavel Skripkin wrote: > genl_family_rcv_msg_attrs_parse() can return NULL > pointer: > >         if (!ops->maxattr) >                 return NULL; > > But this condition doesn't cause an error in > genl_family_rcv_msg_doit And I'm almost certain that in fact it shouldn't cause an error! If the family doesn't set maxattr then it doesn't want to have generic netlink doing the parsing, but still it should be possible to call the ops. Look at fs/dlm/netlink.c for example, it doesn't even have attributes. You're breaking it with this patch. Also, the (NULL) pointer is not actually _used_ anywhere, so why would it matter? johannes