2002-09-30 13:58:26

by Jon Grimm

[permalink] [raw]
Subject: Re: [Lksctp-developers] Re: (more) Sleeping function called from illegal context...

See Patch below to stop any bleeding. I'll feed the patch in through
DaveM.

Thanks, Jon

Andrew Morton wrote:
>
> Luc Van Oostenryck wrote:
> >

> >
>
> sctp_v4_get_local_addr_list():
>
> /* XXX BUG: sleeping allocation with lock held -DaveM */
> addr = t_new(struct sockaddr_storage_list, GFP_KERNEL);
>
> Is true. We're holding dev_base_lock, inetdev_lock and in_dev->lock
> here.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or
higher.
# This patch includes the following deltas:
# ChangeSet 1.655 -> 1.656
# net/sctp/protocol.c 1.7 -> 1.8
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/30 [email protected] 1.656
# sctp: Fix GFP_KERNEL allocation with lock held.
# --------------------------------------------
#
diff -Nru a/net/sctp/protocol.c b/net/sctp/protocol.c
--- a/net/sctp/protocol.c Mon Sep 30 08:20:55 2002
+++ b/net/sctp/protocol.c Mon Sep 30 08:20:55 2002
@@ -119,8 +119,7 @@

for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
/* Add the address to the local list. */
- /* XXX BUG: sleeping allocation with lock held -DaveM */
- addr = t_new(struct sockaddr_storage_list, GFP_KERNEL);
+ addr = t_new(struct sockaddr_storage_list, GFP_ATOMIC);
if (addr) {
INIT_LIST_HEAD(&addr->list);
addr->a.v4.sin_family = AF_INET;
@@ -157,8 +156,7 @@
read_lock_bh(&in6_dev->lock);
for (ifp = in6_dev->addr_list; ifp; ifp = ifp->if_next) {
/* Add the address to the local list. */
- /* XXX BUG: sleeping allocation with lock held -DaveM */
- addr = t_new(struct sockaddr_storage_list, GFP_KERNEL);
+ addr = t_new(struct sockaddr_storage_list, GFP_ATOMIC);
if (addr) {
addr->a.v6.sin6_family = AF_INET6;
addr->a.v6.sin6_port = 0;