[PATCH v3] nvme-tcp: fix a possible UAF when failing to allocate an io queue

Christoph Hellwig hch at lst.de
Wed Mar 22 01:15:39 PDT 2023


On Tue, Mar 21, 2023 at 05:12:57AM +0000, Chaitanya Kulkarni wrote:
> > +#ifdef CONFIG_NET_RX_BUSY_POLL
> > +	queue->sock->sk->sk_ll_usec = 1;
> > +#endif
> > +	write_unlock_bh(&queue->sock->sk->sk_callback_lock);
> > +}
> > +
> 
> since its is not in the fast path, is there a particular reason not
> to use following ?
> 
> if (IS_ENABLED(CONFIG_NET_RX_BUSY_POLL)
> 	queue->sock->sk->sk_ll_usec = 1;

That won't compile, as the sk_ll_usec is not defined without
CONFIG_NET_RX_BUSY_POLL.

Note that this has nothing to do with a fast path - for cases where
IS_ENABLED works there is no performance benefit to use an ifdef
given that IS_ENABLED is ѕpecifically designed to lead to compiler
dead code elimination.



More information about the Linux-nvme mailing list