Skip to contentSkip to conversation

bpf: sockmap, double free in __sock_map_ctx_update_elem()

PATCH In review Dan Carpenter 3 participants 4 messages May 18, 2018 – May 19, 2018

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

PATCH 1/2 bpf: sockmap, double free in __sock_map_ctx_update_elem()

We accidentally free "e" twice.

Fixes 81110384441a ("bpf: sockmap, add hash map support")
kernel/bpf/sockmap.c +0 -1
index c6de1393df63..216d5c9b0eb3 100644
@@ -1833,7 +1833,6 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map,
 	if (tx_msg)
 		bpf_prog_put(tx_msg);
 	write_unlock_bh(&sock->sk_callback_lock);
-	kfree(e);
 	return err;
 }
 
maintainer
#1 lore raw

Hi Dan,

Quoted 10 lines · Dan Carpenter

We accidentally free "e" twice.

Fixes 81110384441a ("bpf: sockmap, add hash map support")
kernel/bpf/sockmap.c +0 -0
index c6de1393df63..216d5c9b0eb3 100644

kernel/bpf/sockmap.c static int __sock_map_ctx_update_elem(struct bpf_map *map, · line 1837

Quoted 6 lines
kernel/bpf/sockmap.c +0 -1
@@ -1833,7 +1833,6 @@ static int __sock_map_ctx_update_elem(struct bpf_map *map,
 	if (tx_msg)
 		bpf_prog_put(tx_msg);
 	write_unlock_bh(&sock->sk_callback_lock);
-	kfree(e);
 	return err;
 }

Thanks for the two fixes, appreciate it! There were two similar ones that fix the same issues which were already applied yesterday to bpf-next:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id4364560361d57e8cd873a8990327f3471d7d8a
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id§8622932c27e8ec33e5ba180f3d2e87fb806b28
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 6 lines · Daniel Borkmann

Thanks for the two fixes, appreciate it! There were two similar ones that fix the same issues which were already applied yesterday to bpf-next:

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id4364560361d57e8cd873a8990327f3471d7d8a
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id§8622932c27e8ec33e5ba180f3d2e87fb806b28

Hey Gustavo,

We're sort of duplicating each other's work. Could you CC [email protected] for static checker fixes so that I can see what you're working on?

We'll probably still send the occasional duplicate which is fine...

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Dan,

Quoted 5 lines · Dan Carpenter
Quoted 4 lines · Daniel Borkmann

Thanks for the two fixes, appreciate it! There were two similar ones that fix the same issues which were already applied yesterday to bpf-next:

Quoted 9 lines
Quoted 2 lines

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id4364560361d57e8cd873a8990327f3471d7d8a
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id§8622932c27e8ec33e5ba180f3d2e87fb806b28

Hey Gustavo,

We're sort of duplicating each other's work. Could you CC [email protected] for static checker fixes so that I can see what you're working on?

Sure thing.

I've been doing this work for more than a year now and just recently we are having these issues. I'm a bit curious about it.

Quoted 2 lines

We'll probably still send the occasional duplicate which is fine...

Yep. Not a big deal for me.

Have a good one.
--
Gustavo
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html