Re: [PATCH net] sctp: use gfp insteaad of GFP_NOWAIT in idr_alloc_cyclic when sctp_assoc_set_id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 7, 2016 at 7:21 AM, Eric Dumazet <eric.dumazet@xxxxxxxxx> wrote:
> What is the problem of being not able to allocate memory at this point ?
>
Now I think about it again,  this patch cannot work, because of:
__sctp_connect()
    sctp_assoc_set_id(asoc, GFP_KERNEL)

thanks, Eric

> If really it bothers you (although we have thousands of other places it
> can happen), maybe add __GFP_NOWARN
>
> But whatever flag we use here, idr_alloc() _can_ fail.
>
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index 2bf8ec92dde4..2ae3874e3696 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -1606,7 +1606,8 @@ int sctp_assoc_set_id(struct sctp_association *asoc, gfp_t gfp)
>                 idr_preload(gfp);
>         spin_lock_bh(&sctp_assocs_id_lock);
>         /* 0 is not a valid assoc_id, must be >= 1 */
> -       ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0, GFP_NOWAIT);
> +       ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0,
> +                              (gfp & ~__GFP_DIRECT_RECLAIM) | __GFP_NOWARN);
>         spin_unlock_bh(&sctp_assocs_id_lock);
>         if (preload)
>                 idr_preload_end();
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux