Skip to contentSkip to conversation

smb: client: use GFP_KERNEL for registry allocation

PATCH Applied Fredric Cover 2 participants 2 messages Jul 22 – Jul 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: use GFP_KERNEL for registry allocation

From: Fredric Cover <[email protected]>

Currently, cifs_get_swn_reg() allocates new registry entries using GFP_ATOMIC. Since we lock a mutex here, this is clearly not an atomic context. Use GFP_KERNEL instead.

Also, fix a minor grammatical error in the comment above the function.

---
 fs/smb/client/cifs_swn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/cifs_swn.c +3 -3
index 9951817d0d7f..fe10719e627e 100644
@@ -425,7 +425,7 @@ static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
 
 /*
  * Get a registration for the tcon's server and share name, allocating a new one if it does not
- * exists
+ * exist.
  */
 static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
 {
@@ -443,7 +443,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
 		goto unlock;
 	}
 
-	reg = kmalloc_obj(struct cifs_swn_reg, GFP_ATOMIC);
+	reg = kmalloc_obj(struct cifs_swn_reg, GFP_KERNEL);
 	if (reg == NULL) {
 		ret = -ENOMEM;
 		goto fail_unlock;
@@ -451,7 +451,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
 
 	kref_init(&reg->ref_count);
 
-	reg->id = idr_alloc(&cifs_swnreg_idr, reg, 1, 0, GFP_ATOMIC);
+	reg->id = idr_alloc(&cifs_swnreg_idr, reg, 1, 0, GFP_KERNEL);
 	if (reg->id < 0) {
 		cifs_dbg(FYI, "%s: failed to allocate registration id\n", __func__);
 		ret = reg->id;
Signature · 1 line
2.53.0
Applied
#1 lore raw

merged into cifs-2.6.git for-next

Quoted 49 lines · Fredric Cover

From: Fredric Cover <[email protected]>

Currently, cifs_get_swn_reg() allocates new registry entries using GFP_ATOMIC. Since we lock a mutex here, this is clearly not an atomic context. Use GFP_KERNEL instead.

Also, fix a minor grammatical error in the comment above the function.

---
 fs/smb/client/cifs_swn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/cifs_swn.c +3 -4
index 9951817d0d7f..fe10719e627e 100644
@@ -425,7 +425,7 @@ static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
 
 /*
  * Get a registration for the tcon's server and share name, allocating a new one if it does not
- * exists
+ * exist.
  */
 static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
 {
@@ -443,7 +443,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
                goto unlock;
        }
 
-       reg = kmalloc_obj(struct cifs_swn_reg, GFP_ATOMIC);
+       reg = kmalloc_obj(struct cifs_swn_reg, GFP_KERNEL);
        if (reg == NULL) {
                ret = -ENOMEM;
                goto fail_unlock;
@@ -451,7 +451,7 @@ static struct cifs_swn_reg *cifs_get_swn_reg(struct cifs_tcon *tcon)
 
        kref_init(&reg->ref_count);
 
-       reg->id = idr_alloc(&cifs_swnreg_idr, reg, 1, 0, GFP_ATOMIC);
+       reg->id = idr_alloc(&cifs_swnreg_idr, reg, 1, 0, GFP_KERNEL);
        if (reg->id < 0) {
                cifs_dbg(FYI, "%s: failed to allocate registration id\n", __func__);
                ret = reg->id;
--

2.53.0

Signature · 3 lines
Thanks,

Steve