Skip to content

Commit

Permalink
6pack: fix free memory scribbles
Browse files Browse the repository at this point in the history
commit acf673a fixed a user triggerable free
memory scribble but in doing so replaced it with a different one that allows
the user to control the data and scribble even more.

sixpack_close is called by the tty layer in tty context. The tty context is
protected by sp_get() and sp_put(). However network layer activity via
sp_xmit() is not protected this way. We must therefore stop the queue
otherwise the user gets to dump a buffer mostly of their choice into freed
kernel pages.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
One Thousand Gnomes authored and David S. Miller committed Jan 6, 2016
1 parent 55795ef commit 60aa3b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/hamradio/6pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ static void sixpack_close(struct tty_struct *tty)
if (!atomic_dec_and_test(&sp->refcnt))
down(&sp->dead_sem);

/* We must stop the queue to avoid potentially scribbling
* on the free buffers. The sp->dead_sem is not sufficient
* to protect us from sp->xbuff access.
*/
netif_stop_queue(sp->dev);

del_timer_sync(&sp->tx_t);
del_timer_sync(&sp->resync_t);

Expand Down

0 comments on commit 60aa3b0

Please sign in to comment.