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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75CA7C07E9D for ; Mon, 26 Sep 2022 14:09:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234513AbiIZOJL (ORCPT ); Mon, 26 Sep 2022 10:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234914AbiIZOIk (ORCPT ); Mon, 26 Sep 2022 10:08:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186ED24D; Mon, 26 Sep 2022 05:19:30 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 68BA31F8AA; Mon, 26 Sep 2022 12:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1664193738; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z5yBy6W2fnTZVXsf//nbkl+cALY92UVk+B+WQamcjzo=; b=teQ+cileX93nVAfM0CquqykdkJ/g++nir/f0UTviBL1F8Lost0M1xCMd+msl2JwjyhVHJz BFxhuR0Uc2//hJBcT52KonqOfKhHjOZSpulwLUcCCi8Cywz7EK9dqg3iICMQ7yQH3WwF9n B+6jAM0rkgp/jFwShic1qOItxFZQMJQ= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 49AE3139BD; Mon, 26 Sep 2022 12:02:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id E1C5D8qUMWM5RAAAMHmgww (envelope-from ); Mon, 26 Sep 2022 12:02:18 +0000 Date: Mon, 26 Sep 2022 14:02:17 +0200 From: Michal Hocko To: Florian Westphal Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, vbabka@suse.cz, akpm@linux-foundation.org, urezki@gmail.com, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, Martin Zaharinov Subject: Re: [PATCH mm] mm: fix BUG with kvzalloc+GFP_ATOMIC Message-ID: References: <20220923103858.26729-1-fw@strlen.de> <20220923133512.GE22541@breakpoint.cc> <20220926075639.GA908@breakpoint.cc> <20220926100800.GB12777@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220926100800.GB12777@breakpoint.cc> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 26-09-22 12:08:00, Florian Westphal wrote: > Michal Hocko wrote: > > + old_tbl = rht_dereference_rcu(ht->tbl, ht); > > + size = tbl->size; > > + > > + data = ERR_PTR(-EBUSY); > > + > > + if (rht_grow_above_75(ht, tbl)) > > + size *= 2; > > + /* Do not schedule more than one rehash */ > > + else if (old_tbl != tbl) > > + return data; > > + > > + data = ERR_PTR(-ENOMEM); > > + > > + rcu_read_unlock(); > > + new_tbl = bucket_table_alloc(ht, size, GFP_KERNEL); > > + rcu_read_lock(); > > I don't think this is going to work, there can be callers that > rely on rcu protected data structures getting free'd. The caller of this function drops RCU for each retry, why should be the called function any special? -- Michal Hocko SUSE Labs